Skip to content

Studio: list, reveal and delete audio.cpp umbrella models by folder - #13519

Merged
danielhanchen merged 27 commits into
unslothai:mainfrom
Etherll:fix/studio-audio-umbrella-model-ids
Oct 13, 2026
Merged

danielhanchen merged 27 commits into
unslothai:mainfrom
Etherll:fix/studio-audio-umbrella-model-ids

Conversation

@Etherll

@Etherll Etherll commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Models downloaded from the audio-cpp/audio.cpp-gguf umbrella repo (for example Qwen3-TTS-12Hz-0.6B-Base-GGUF) did not show up under On Device on the Audio pages, and Show in folder and Delete on them failed with Invalid repo_id format. Their ids have the form audio-cpp/audio.cpp-gguf/<Folder>, while the cache routes only accepted owner/name and the cached GGUF inventory listed the whole umbrella repo as one row that the pickers hide.

Fix

  • cached_folder_target() in audio_cpp_models.py turns a folder id into the umbrella repo plus that folder's own variant keys (<Folder>/<file>), from the cache only. It never falls back to the whole repo or to a bare quant like Q8_0, which names a file in every folder, so deleting one folder cannot touch the others. An uncached quant is a 404.
  • Delete, delete impact, cached model path and reveal go through that translation. Without a variant, the path is <Folder> in the snapshot holding a complete cached variant of it, not the repo's snapshot root.
  • The audio model delete guard compares per folder: a loaded Kokoro no longer blocks deleting Qwen3-TTS, the loaded folder itself is still refused, and a folder a loaded model opens as a companion (MioTTS opens MioCodec) is held too.
  • /api/hub/cached-gguf adds one row per downloaded folder that an Audio page can use, flagged umbrella_folder. The Model Hub, chat picker, chat search and Agents settings drop these rows and keep the single umbrella row; the Audio pages list them through their existing allowed-id set.
  • The GGUF variants listing answers a folder id even when the picker sends it as local_path, so the quant row and its menu work.
  • On Device rows show the folder name, sit in the Unsloth group instead of "Other models", get the row menu, and link to huggingface.co/audio-cpp/audio.cpp-gguf/tree/main/<Folder>. looksLikeModelPath no longer treats a folder id as a path, matching the backend.
  • A folder variant delete also removes the files listed beside its GGUF (voice embeddings, configs), unless another cached variant of the folder, or a variant of the same directory still downloading, uses them. The delete preview counts the same files. A quant of the folder cancelled before any file finished (only a manifest or cancel marker and .incomplete blobs) is included too. All of a folder's variants are reserved before the first one is removed, so a conflicting download refuses the delete up front.
  • Invalidating the HF cache scans also clears the audio.cpp memo, and a lookup that began before the change does not store its old answer. A folder whose download just finished is therefore listed on the next scan.
  • Transcribe lists its On Device models from the speech-to-text status, so it re-reads that status when the cache inventory changes and a deleted model leaves the list right away.

Known limits

  • Folder rows and folder actions cover only the active HF cache, the same cache the audio.cpp runtime loads from and downloads into. A copy of the repo in another remembered cache stays manageable from its Model Hub row.
  • Show in folder only appears when Unsloth Studio finds a desktop file manager. On a headless host, the reveal endpoint was checked over the API instead.

Testing

  • New studio/backend/tests/test_audio_cpp_umbrella_ids.py (54 test cases): all pass on this branch. On the base commit 53 fail (Invalid repo_id format, no folder rows, guard never matching); the one that passes is the variants listing without local_path, which already worked.
  • Backend run over the touched areas (test_audio_cpp_*, test_cache_inventory*, test_cached_gguf_routes, test_gguf_variant*, hub/tests/test_model_services.py): all pass except 5 test_model_services.py::test_delete_variant_* tests, which fail the same way on the base commit.
  • Frontend: npm test has 0 failures (new audio-umbrella-on-device-rows.test.ts, additions to audio-cpp-catalog.test.ts and model-identity.test.ts), and npm run typecheck and npm run build pass.
  • Manual check in a CPU-only Unsloth Studio with Qwen3-TTS Base, Qwen3-ASR and the forced aligner cached: Qwen3-TTS shows under On Device on Clone and Qwen3-ASR on Transcribe, and both load from there. The delete dialog shows 2.0 GB, not the whole repo. Deleting Qwen3-TTS is refused while it is loaded and succeeds while Qwen3-ASR is loaded, leaving the ASR and aligner files. Deleting the loaded ASR folder is refused. Reveal and cached path return the folder's file. The Model Hub still shows one umbrella row, and the chat picker shows no folder rows.

Screenshots

On Device on Clone and Transcribe, before and after

On Device on Clone and Transcribe: main cf6e3e337 (before) vs this PR at 7d2595be6 (after).

Text to Speech page

Text to Speech On Device list, before and after

Audio > Text to Speech, model selector, On Device, with Kokoro-82M-GGUF (Q8_0 + BF16) and Piper-TTS-GGUF downloaded from audio-cpp/audio.cpp-gguf: merge base 90a968cd8 (before) lists nothing, this PR at bbeb87797 (after) lists one row per folder.

Kokoro row expanded to its quants, Piper row menu

After: clicking the Kokoro-82M-GGUF row lists its two downloaded quants with their own menus (no Invalid repo_id error), and the Piper-TTS-GGUF row menu offers Pin and Delete. The Delete dialog names only Piper-TTS-GGUF (orig) and frees 63 MB.

On Device on Text to Speech, before and after

Merge base (left) vs this PR at 7b476710e (right), two isolated Unsloth Studio installs sharing an HF cache that holds only the Piper-TTS-GGUF and Citrinet-ASR-GGUF folders of audio-cpp/audio.cpp-gguf. Main lists nothing On Device and answers GET /api/models/cached-model-path for the folder id with 400; this PR lists Piper-TTS-GGUF (63 MB), adds both folder rows to /api/hub/cached-gguf, and answers 200.

On Device with audio.cpp folders cached, before and after

Downloaded models from the audio-cpp/audio.cpp-gguf umbrella repo were
missing from On Device, and Show in folder and Delete failed with
"Invalid repo_id format" for their audio-cpp/audio.cpp-gguf/<Folder> ids.

Delete, delete impact, cached path and reveal now translate a folder id,
from the cache only, into the umbrella repo plus that folder's own
variant keys, never the whole repo. The audio model delete guard compares
per folder (and holds a companion folder a loaded model opens). The
cached GGUF inventory lists each downloaded folder, flagged so the Model
hub keeps its single umbrella row, and the Audio pages show them with
their folder name in the Unsloth group, a menu and a tree/main hub link.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T12:06:03.291848Z 7b47671 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

pre-commit-ci Bot and others added 22 commits October 13, 2026 03:24
…s listing

A folder variant delete now also removes the files that variant lists
beside its GGUF (voice embeddings, configs), keeping any another cached
variant of the folder still uses, and the delete preview counts them.

Invalidating the HF cache scans also drops the audio.cpp memo, so a
folder whose download just finished lists under On Device on the next
scan instead of up to 20 seconds later.
Deleting every variant of an audio.cpp folder removes the files those
variants share, but each variant's preview counted them as still needed
by the other, so the dialog understated the space freed.
…be after a delete

A folder variant deleted while a sibling quant of the same folder is
still downloading keeps the files beside its GGUF, since the sibling is
not listed yet and needs them. Umbrella folder ids holding a colon name
nothing, so a drive-like name cannot resolve to the snapshot root.

Transcribe lists its On Device models from the speech-to-text status, so
it now re-reads that status when the cache inventory changes and a
deleted model leaves the list right away.
…oice files

Every audio.cpp umbrella folder downloads on the same repo, so a download
of any other folder counted as a sibling and left the deleted variant's
voice files behind with no row to remove them. The peer check now takes
a path prefix, and the delete and its preview use the same answer.
…hing

With tiny/Q8_0 and small/Q8_0 cached, a bare Q8_0 was ranked onto one of
them, so reveal, delete impact and delete could act on a size the caller
never picked. A folder action now needs the exact key or file, or a
quant that matches exactly one cached variant.
A folder delete removed its variants one at a time and released each
reservation before the next, so a download of a later variant could
start midway and fail the delete after earlier ones were gone. All of
the folder's cached variants are now reserved first; a conflicting
download refuses the delete before anything is removed.
A folder action sent with a variant of "/" matched every cached variant
of the folder, so a delete scoped to one variant removed them all. An
empty path now names nothing and returns 404.
… text

Words of a folder action's variant matched as substrings of the whole
variant path, so ".", "gguf" or the folder's own name matched every
cached variant. A word must now be a directory of the variant key or a
word of its file name the folder name does not supply, and a file name
or stem names that one file.
…eights

With refs/main on a newer snapshot that kept only the folder's metadata,
Show in folder opened that copy instead of the older snapshot holding
the downloaded GGUF. The folder path now prefers a snapshot whose folder
contains a GGUF.
…apshot

The snapshot whose folder holds the weights was found with a
case-sensitive glob, so an uppercase .GGUF fell back to a newer
metadata-only copy.
… a sibling downloads

With a variant of the same folder still downloading, the delete keeps
the files its finished siblings share, but the preview still counted
them as freed.
…folder preview

A download in one language directory zeroed the shared-file bytes for
the whole folder, so the preview undercounted the other directories'
voice files the delete still removes.
…nged

A downloaded_models() or resolve() call already reading the cache when a
download finished could store its old answer after forget() cleared the
memo. forget() now bumps a generation, and an answer is stored only if
none ran meanwhile.
…wnload state

A quant of an umbrella folder cancelled before any file finished has no
GGUF on disk, only its manifest or cancel marker and .incomplete blobs,
so a folder delete skipped it and a delete of that quant returned 404.
Planner keys under the folder with download state are now included,
and the normal variant delete clears their partial state.
…ad's state

A bare quant two cached sizes of a folder share named nothing on disk,
so the folder action fell through to download state and could pick a
third size's cancelled download. A quant that matches anything on disk
no longer looks at download state.
…e shares its quant

The guard that keeps an ambiguous quant from falling back to download
state compared the quant alone, so with tiny Q8_0 on disk a delete of a
cancelled medium/Q8_0 found nothing. It now refuses only when the quant
and scope words fit several variants on disk.
…izes share

Show in folder preferred any snapshot whose folder held a .gguf, so a
newer copy with only an adapter or a partial file won over the snapshot
with the downloaded model; it now prefers a snapshot holding a cached
variant's own file. A bare file name shared by two directories of a
folder now names neither instead of the first.
A newer snapshot with a folder's GGUF but not the voice files beside it
still won over the older snapshot with the complete variant. The folder
path now needs every file of some variant, as the On Device listing
does.
@Etherll

Etherll commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

Downloaded models from the audio-cpp/audio.cpp-gguf repo now appear under On Device on the Audio pages they belong to (Qwen3-TTS Base on Clone, Qwen3-ASR on Transcribe), listed by folder name. Show in folder and Delete work on them.

What changed

  • Delete, the delete preview, cached path and reveal rejected folder ids such as audio-cpp/audio.cpp-gguf/<Folder> with "Invalid repo_id format". They now map a folder id to that folder's own variants. A delete removes only that folder (its GGUFs, the voice files beside them, and half-downloaded quants), never the rest of the repo, and a quant that does not name exactly one variant returns 404.
  • The cached GGUF list showed the repo as one row that the Audio pages hide. It now also lists each downloaded folder an Audio page can use; the Model Hub, chat and Agents settings keep the single repo row.
  • A loaded audio model blocked deleting any folder of the repo. Now only that folder, or a folder it loads as a companion, is blocked, and Transcribe drops a deleted model from its list right away.

The 54 new backend test cases pass on 7d2595be6; 53 of them fail on the base commit. The frontend suite and typecheck pass. In a CPU-only Unsloth Studio with Qwen3-TTS Base, Qwen3-ASR and the forced aligner cached, both folders list and load from On Device. Deleting Qwen3-TTS is refused while it is loaded. Deleting it while Qwen3-ASR is loaded removes only its file, and deleting the loaded ASR folder is refused. Show in folder only appears where Unsloth Studio finds a desktop file manager, so on that headless machine the reveal endpoint was checked directly.

On Device on Clone and Transcribe, before and after

On Device on Clone and Transcribe: main cf6e3e337 (before) vs this PR at 7d2595be6 (after).

@danielhanchen danielhanchen self-assigned this Oct 13, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8b8d212d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if not keys:
raise HTTPException(status_code = 404, detail = "Model not found in cache")
if variant:
return _resolve_cached_model_path(umbrella, keys[0])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve folder variants inside the active cache

When the same umbrella folder/variant exists in both the active HF cache and another remembered cache, this delegates to _resolve_cached_model_path, which scans revisions from every cache and returns the newest matching file. cached_folder_target and the synthetic folder row are active-cache-only, so /cached-model-path and Show in folder can point at the stale copy in a different cache instead of the row the user acted on; resolve the translated key against the active cache snapshot rather than the multi-cache resolver.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this here: with a variant the folder row goes through the same multi-cache resolver every other cached GGUF repo already uses, so this matches existing Show in folder behaviour, and it needs the same folder cached in two HF caches. It only affects which copy is revealed, never what is loaded or deleted.

from core.inference.audio_cpp_models import forget
except Exception: # noqa: BLE001 - no audio.cpp support, nothing memoized
return
forget()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear the audio memo before publishing invalidation

When a concurrent inventory request starts after _hf_cache_scans_epoch is incremented but before this forget() call, it observes the new epoch while downloaded_models() can still return the old audio.cpp memo. That scan is then accepted and cached as a post-invalidation result because its epoch remains current, leaving a just-finished or just-deleted folder absent or present until another refresh; clear the audio memo before making the new epoch visible.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this: the window is the few instructions between the epoch bump and forget() on the same thread, and the audio listing memo expires after 10 s anyway, so a stale row self-heals on the next refresh. Not reachable as a lasting wrong state.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 13, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

3 similar comments
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 7b476710e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 13, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 13, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 13, 2026
@danielhanchen
danielhanchen merged commit 3207f04 into unslothai:main Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants