Repository navigation
Studio: list, reveal and delete audio.cpp umbrella models by folder - #13519
Conversation
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.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…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.
|
Downloaded models from the What changed
The 54 new backend test cases pass on On Device on Clone and Transcribe: main |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 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]) |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |

Summary
Models downloaded from the
audio-cpp/audio.cpp-ggufumbrella 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 withInvalid repo_id format. Their ids have the formaudio-cpp/audio.cpp-gguf/<Folder>, while the cache routes only acceptedowner/nameand the cached GGUF inventory listed the whole umbrella repo as one row that the pickers hide.Fix
cached_folder_target()inaudio_cpp_models.pyturns 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 likeQ8_0, which names a file in every folder, so deleting one folder cannot touch the others. An uncached quant is a 404.<Folder>in the snapshot holding a complete cached variant of it, not the repo's snapshot root./api/hub/cached-ggufadds one row per downloaded folder that an Audio page can use, flaggedumbrella_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.local_path, so the quant row and its menu work.huggingface.co/audio-cpp/audio.cpp-gguf/tree/main/<Folder>.looksLikeModelPathno longer treats a folder id as a path, matching the backend.Known limits
Testing
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 withoutlocal_path, which already worked.test_audio_cpp_*,test_cache_inventory*,test_cached_gguf_routes,test_gguf_variant*,hub/tests/test_model_services.py): all pass except 5test_model_services.py::test_delete_variant_*tests, which fail the same way on the base commit.npm testhas 0 failures (newaudio-umbrella-on-device-rows.test.ts, additions toaudio-cpp-catalog.test.tsandmodel-identity.test.ts), andnpm run typecheckandnpm run buildpass.Screenshots
On Device on Clone and Transcribe: main
cf6e3e337(before) vs this PR at7d2595be6(after).Text to Speech page
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 base90a968cd8(before) lists nothing, this PR atbbeb87797(after) lists one row per folder.After: clicking the Kokoro-82M-GGUF row lists its two downloaded quants with their own menus (no
Invalid repo_iderror), 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 ofaudio-cpp/audio.cpp-gguf. Main lists nothing On Device and answersGET /api/models/cached-model-pathfor 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.