Repository navigation
Studio: fix audio.cpp partial downloads, aligner progress, CPU fallback - #13515
Conversation
…CPU fallback - Umbrella folder and package quant rows report partial after a cancelled or incomplete download, so the row menu can clean them up. - An in-flight umbrella download keeps its folder row and quant (e.g. Moonshine small/Q8_0) after a page reload. - Timestamps on Transcribe fetch the Qwen3 forced aligner through the Downloads panel, with progress and cancel, before the run. - The Downloads panel names an audio.cpp folder STT download by its quant. - A CUDA or HIP audio.cpp build launches on CPU on auto when no GPU of that vendor is visible; GPU init failures no longer read as an incomplete model file, and the runtime status reports the launch backend. - The audio page's staged TTS download clears its pending load on cancel.
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. |
…indows host_gpu_vendors only checks driver DLLs on Windows, so a CUDA or HIP build with CUDA_VISIBLE_DEVICES or HIP_VISIBLE_DEVICES hiding every device still launched on the GPU backend there. Apply the masks in _gpu_vendors on every platform.
When the Hub listing call fails, resolve falls back to the HF cache, where a crowded folder can name another size's file under the requested row. Carry the listing's provenance on the resolved model and record the job's row only when it came from the Hub.
…me status off the event loop An umbrella folder whose family is not recognized resolved through an early return that dropped from_hub, so its download row was never recorded. The runtime status's launch backend can run the binary's --version, so the async STT status route now reads it in a worker thread.
…r its download Turning Timestamps off while the aligner downloads no longer keeps Transcribe blocked, and a run without timestamps replaces one waiting on the aligner. A finished model download now clears audio.cpp's remembered cache misses, so the capabilities refresh on completion reports the aligner as downloaded.
…ack STT server across training Turning Timestamps off while the aligner downloads now drops the waiting transcription instead of starting it without timestamps later. The audio.cpp STT sidecar records where its server actually runs, so a GPU build that already fell back to the CPU is not reloaded when training starts or ends.
download_target's (planner key -> row, quant) record lived only in memory, so a backend restarted mid-download named a multi-size folder's job by its bare quant (Moonshine small/Q8_0 as Q8_0). The record is now also saved in the Hub state dir, read after the in-memory one, validated on read and dropped when the job ends. A file name alone cannot give the row key: it depends on the sizes beside it.
Two backends on one install could each read the shared JSON map and replace it with only their own update, dropping the other's row. Each planner key now has its own file, written by one atomic replace and removed when the job ends, so concurrent writers never merge. Any unreadable record, including absurdly nested JSON, reads as absent.
…d until its download finishes A cross-tab session change cleared every download job but left a mounted page's staged plan behind, so Transcribe stayed blocked on the aligner. Staging hooks now drop their plan (and run onCancelled) when the download manager resets. A cancelled or failed umbrella job no longer deletes its saved row, which stays correct and may serve another backend's download of the same key; only a finished download, whose row the cache then names, removes it.
…celled Images and the Hub queue start their next plan from onCancelled, so calling it on a cross-tab session reset carried the old session's queued plans into the new one. Staging hooks now call a separate optional onReset; the aligner and the audio TTS slot use it to drop their pending run, and everyone else just loses the stale plan.
…handles it Dropping every staged plan on a cross-tab session reset left the Images page and the Hub queue holding their own plans with nothing behind them. Only a consumer that passes onReset (the aligner and the audio TTS slot) now loses its plan; the rest keep the old behavior. The test now fails if the reset path calls onCancelled.
…p rows; tell the user when the aligner finishes mid-load
|
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5583c9ccc
ℹ️ 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".
| from hub.utils.gguf import gguf_variant_key | ||
|
|
||
| return model.repo_id, gguf_variant_key(model.variant.primary) | ||
| key = gguf_variant_key(model.variant.primary) |
There was a problem hiding this comment.
Resolve folder polls from the saved target mapping
When an umbrella download is polled from a sibling/restarted backend while the Hub listing is unavailable, resolve(identifier, variant) can see only cached siblings; for a crowded folder it marks the requested variant unsupported but returns the default cached sibling. Deriving key from that fallback makes _audio_cpp_target status/progress/cancel calls address the sibling job (or return 404 when no sibling is cached), even though the new persisted row record contains the active real key. Consult that mapping in the forward direction before falling back to cache-only resolution.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this here: forward resolution of a row is unchanged from the merge base (download_target already resolved from the cache when the Hub listing fails), and it needs a restarted or sibling backend polling a crowded-folder job during a Hub outage. Out of scope for this PR.
| companions_cached | ||
| and audio_cpp_files.cached_files(model.with_variant(variant)) is not None | ||
| ) | ||
| row_model = model.with_variant(variant) |
There was a problem hiding this comment.
Include state-only variants in cache-only audio listings
When Hub access is unavailable after a download was interrupted before all files were linked, _cached_listing excludes the .incomplete blobs and _package_variants omits an incomplete package mix, so that target is absent from model.variants. Because the new partial detection only runs for variants entering this loop, a cache-only umbrella/package listing drops the canceled row entirely (or returns 404 if it is the only row) despite its manifest and cancel marker, preventing the interrupted variant from being surfaced for resume; reconcile state-only variants before building these rows as the generic GGUF path does.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this here: the cache-only listing is unchanged from the merge base, which also dropped an interrupted umbrella variant whose files are only .incomplete blobs; this PR adds partial rows to the online listing. Offline reconciliation of state-only variants is a separate change.
|
@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: d5583c9ccc
ℹ️ 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".
| queueRef.current = null; | ||
| generation.current += 1; | ||
| inFlight.current = null; | ||
| setQueue(null); | ||
| onResetRef.current?.(); |
There was a problem hiding this comment.
Abort in-flight staged starts during session resets
When a sign-in/sign-out reset fires while downloadManager.requestStart(...) is still awaiting transport, status, or start round trips, this handler only clears React ownership and increments the local generation; it does not cancel or epoch-gate the pending request. That request can resume after resetDownloadManagerState() and repopulate the cleared manager, or finish starting an orphan backend job, so an aligner/TTS download from the previous session survives the boundary even though onReset dropped its pending action. Carry the reset epoch or an abort signal into the start path and reject it before manager/backend side effects.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this here: an in-flight requestStart racing a cross-tab sign-in/out lives in the shared download manager and applies to every download start on the merge base too; this PR only adds dropping the staged plan on reset. Epoch-gating requestStart is a separate change to the download manager.
… the catalog test
|
Codex Review: Didn't find any major issues. Chef's kiss. 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
Fixes six problems Unsloth Studio users hit with audio.cpp models from the
audio-cpp/audio.cpp-ggufumbrella repo. Problems covered: cancelled downloads, the hidden timestamp aligner download, and CUDA builds on machines with no visible GPU.Fixes
.incompletefiles could not be removed._audio_cpp_variants_answernever setpartialon umbrella rows. A row is now partial when it has a cached file that only it lists, or when the cache scan finds its blobs incomplete. It also reportsdownload_remaining_bytes,partial_transportandpartial_resumable. Files that every row lists (package configs, a voice folder, a shared codec) are not counted for one row, so siblings do not show as partial.folder_row_for_downloadrebuiltQ8_0instead ofsmall/Q8_0, because the file in flight has no cache entry yet.download_targetnow records the row id and quant when the job starts, andfolder_row_for_downloadreads that first. The cache and planner-path fallbacks are unchanged. Only a resolve whose listing came from the Hub is recorded, so an offline status read or a failed Hub call that fell back to the cache cannot rename a started job. The record is also saved, one small file per planner key in the Hub state dir, so a backend restarted mid-download (or another backend on the same install) still names the job by row; a file name alone cannot give the row key, which depends on the sizes beside it. A finished download drops its file, since the cache names the row then./sttcapabilities now return the aligner'sidandvariant. The newuseAlignerDownloadhook stages the aligner through the shared download manager as a normal quant download before the run starts. While it downloads, Transcribe shows "Downloading the timing aligner…". When it finishes, the run starts only if the page is still visible, still in Transcribe mode and still on the same audio. Turning Timestamps off, or starting a run without them, drops the waiting run and unblocks Transcribe. Cancelling drops the run and shows a toast saying to download again or turn Timestamps off. A sign-in or sign-out in another tab, which clears every download, also drops the waiting aligner plan, so Transcribe is not left blocked. A finished model download now clears audio.cpp's remembered cache misses, so the refresh on completion sees the aligner.CUDA_VISIBLE_DEVICES=""), with a 501 wrapped in "the model file may be incomplete".select_backendtrusted the install record'scuda. It now checkshost_gpu_vendors(), withCUDA_VISIBLE_DEVICES/HIP_VISIBLE_DEVICES/ROCR_VISIBLE_DEVICESapplied on every platform (Windows detection only sees driver DLLs), and launches on CPU when the build's GPU vendor (NVIDIA for CUDA, AMD for HIP) is not visible. If the vendor check fails, it keeps the build's backend.UNSLOTH_AUDIO_CPP_BACKENDand an explicit CPU choice still win. If the server still exits with GPU init output, the error now says no usable GPU is visible and points to the CPU device orUNSLOTH_AUDIO_CPP_BACKEND=cpu, not to the model file. The runtime status addslaunch_backendnext to the build'sbackend, read off the event loop because choosing it can run the binary's--version. The STT server records the backend it actually launched on, so a CPU fallback is not reloaded when training starts or ends.onCancelled, so a cancelled or failed download left a pending load behind. It now callsinvalidatePendingStagedTts.The umbrella download job already fetches every file a row lists plus companions. A test now checks that each row's download covers the files it lists and the bytes it shows.
Testing
Backend:
cd studio/backend python -m pytest tests/test_audio_cpp_models.py tests/test_audio_cpp_server_http.py tests/test_audio_cpp_runtime_status.py tests/test_stt_capabilities.py -qResults: the audio, STT, TTS, GGUF, download and Hub suites pass (about 4,250 in the last full run). The new cases fail on the base commit or on the commit before each fix.
New cases cover partial rows for cancelled umbrella quants, MioTTS codec rows and package mixes, a crowded-folder job in flight keeping its row, an offline status read leaving a started job's row alone, CPU fallback for CUDA and HIP builds with no visible GPU (including masks on a simulated Windows host), the GPU init error message,
launch_backendin the runtime status (read off the event loop), a Hub listing failure not recording a cached guess, a finished download clearing a remembered aligner miss, a CPU-fallback STT server kept across training, crowded-folder jobs keeping their row after a restart with nothing in memory or cache, damaged saved records, and pruning only on completion.Frontend:
cd studio/frontend node --experimental-strip-types --test tests/audio-transcribe-aligner-download.test.ts tests/audio-tts-download-manager.test.ts tests/stt-download-mirror-policy.test.tsThe full
npm testrun passes (11773) andnpm run typecheckis clean.alignerDownloadEntryis unit tested. The aligner wiring, the TTSonCancelledand the Downloads label are checked against source text, not run in a browser.Screenshots
Merge base 67fbacd vs head 40a5e81, CPU-only Unsloth Studio, headless Chromium. Scene 1 uses a real cancelled Q8_0
.incompleteblob; scenes 2 and 3 stub the download network.Known limits
audio-cpp/audio.cpp-gguf/<Folder>) still need the umbrella-id fix in the deletion and reveal routes, which is a separate PR. That fix must also cover a quant that left only.incompleteblobs and download state, since such a quant has no snapshot file.The branch also carries a pre-commit.ci autofix commit that reformats four diffusion files (formatting only, no code change).
Review fixes and evidence (maintainer)
Commits added during review:
CPU fallback on the real audio.cpp CUDA build (v0.9.0-unsloth.1 and v0.9.1-unsloth.1, Moonshine tiny, B200 host):
""CUDA backend requested but registry 'CUDA' has no device 0, reported as "the model file may be incomplete"cpu0cudacudaCancelled BF16 download of
Qwen3-TTS-12Hz-0.6B-Base-GGUFin the Audio page clone selector, merge base vs this PR. The row is now marked partial and gets a menu (API:partialfalse -> true):