Repository navigation
Studio: state the audio memory estimate in placement refusals - #16628
Conversation
The audio.cpp pre-load check refuses a model by its resident estimate, not its file size, but the refusal never said so. It now states the estimate and, when known, the most free memory on one GPU. Smaller-variant suggestions skip packages whose estimate is no lower than the refused one, so ACE-Step turbo Q8_0 no longer suggests base Q8_0, which is 1,152 bytes smaller and needs the same memory. Fixes unslothai#16627
|
@codex review |
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. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
|
This is correct as-is and good to merge. I measured ACE-Step on an RTX 6000 Ada and an RTX 3090 and ran this PR live against main. The worst case, a cover of a 240 s clip, peaked at 11.2 GiB for Q8_0 and 14.7 GiB for BF16, so the new 12.2 / 15.8 GiB estimates hold with about 1 GiB to spare. Live, turbo Q8_0 now loads and runs on 15 GiB free where main refused it, and on 9.5 GiB free it is refused with the stated estimate instead of the same-size base suggestion. Two things I'll fix in a follow-up PR, neither caused by this one:
Keeping YuE2 on the generic estimate here is right given your T4 numbers. The follow-up adds a measured YuE2 profile for newer cards. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
… the load estimate in the picker (unslothai#16726) Follow-up to unslothai#16628. Fixes unslothai#16627. On a 10 GB card, the Create music page refused music models that fit. The model list also showed file sizes that never matched the number in the refusal. After unslothai#16628 this was still true for YuE2, Stable Audio 3 Medium and MiDashengLM-Gen, which used the generic audio.cpp estimate, `weights_GiB * 2.5 + 1.5`. This PR gives the measured music families profiles from their worst observed peaks. The picker now shows the same number the load check compares, and the refusal states how much memory is free when nothing is loaded. ## Measurements Peak GPU memory of the `audiocpp_server` process on audio.cpp v0.9.3, sampled per process through NVML, or amdgpu fdinfo on the Radeon. Each row is the highest of the RTX 3090 and RTX 6000 Ada on CUDA, the RTX 3090 on Vulkan, and, where it ran, a Radeon 8060S on Vulkan. Values in GiB. The worst case observed for each family: - **ACE-Step:** a cover of a 240 s clip. - **YuE2:** 19,851 characters of lyrics, forced to its 360 s cap. - **Stable Audio:** 4 batched takes at its cap (Small 120 s, Medium 240 s). Edits peak lower. - **MiDashengLM-Gen:** its 80 s cap. 10 s peaks the same. - **HeartMuLa:** a 240 s song with 20,000 characters of lyrics. | Model | Package | Worst observed peak | Generic estimate | New estimate | |---|---|---|---|---| | ACE-Step 1.5 Q8_0 | 5.76 | 11.22 | 15.90 | 12.17 | | ACE-Step 1.5 BF16 | 9.40 | 15.31 (Vulkan) | 24.99 | 16.36 | | YuE2 Q4_0 | 2.73 | 6.78 | 8.33 | 7.73 | | YuE2 Q8_0 | 4.22 | 8.58 (Vulkan) | 12.05 | 9.51 | | YuE2 BF16 | 7.01 | 11.87 (Vulkan) | 19.03 | 12.86 | | Stable Audio 3 Small Q8_0 | 1.57 | 2.24 | 5.42 | 3.47 | | Stable Audio 3 Small F16 | 2.20 | 2.80 | 6.99 | 4.60 | | Stable Audio 3 Medium Q8_0 | 3.34 | 5.34 (Vulkan) | 9.84 | 6.66 | | Stable Audio 3 Medium F16 | 5.43 | 9.48 (Vulkan) | 15.08 | 10.43 | | MiDashengLM-Gen Q8_0 | 3.15 | 4.42 (Vulkan) | 9.37 | 5.40 | | HeartMuLa Q8_0 | 7.13 | 19.58 (Vulkan) | 19.33 | 20.53 | Every new estimate leaves at least 0.9 GiB over its worst observed peak, the same margin as the existing profiles. HeartMuLa's generic estimate was too low on Vulkan. Stable Audio Small SFX peaks the same as Small Music. ## Changes - **Profiles in `_MEASURED_PROFILES`:** `stable_audio`, `midashenglm_gen`, `heartmula` and `yue2` are new. `ace_step` becomes `weights * 1.15 + 5.55`, so BF16 keeps the margin on Vulkan and Q8_0 stays at about 12.2 GiB. - YuE2 keeps the generic formula when any NVIDIA card is older than sm_80, or when an NVIDIA host's compute capabilities can't be read, because unslothai#16628's author measured it 2.5 to 4 GiB higher on a T4 than on an L4. - Larger packages than the ones measured get the larger of their profile and the generic formula. - **The picker uses the load check's number.** - The variant listing and the audio catalog carry `estimated_resident_gb`, computed with `estimate_resident_gb` on each request, off the event loop. They carry it only for loads the placement check sizes: TTS, music and separation on a CUDA or XPU host, with a GPU runtime and quant. Dictation, CPU-only runtimes, CPU-only quants (TQ2_1) and other hosts get none and keep the llama.cpp rule. - The quant chooser, single-quant rows and "More models" rows show it as "NGB to run" left of the file size, set like the size, which stays the rightmost column as in the chat and Images pickers. The label and its tooltip are translated in every locale. - The fit badge, the "fits on device" filter and the recommended quant judge audio.cpp rows on it. They used the llama.cpp rules, and the filter counted system RAM toward a load that stays on one card. - They compare it with the largest card torch sees, since automatic placement takes the GPU with the most free memory. llama.cpp's inventory can add Vulkan-only cards the loader does not use. - With "Load model into" set to CPU RAM, they keep the llama.cpp rule, and the rows show no "to run" figure. - The Hub's quant menu judges audio.cpp quants the same way. - A catalog row also carries its smallest GPU variant's estimate, so the filter and the row badge keep a model when any quant fits. On an 8 GB card YuE2 stays listed (Q8_0 needs 9.51 GiB, Q4_0 7.73 GiB) and opens on Q4_0. ACE-Step stays listed on cards that fit Q8_0 but not the BF16 default. - **Rows that disagreed with the load.** - A package's catalog row now counts every file the package loads (YuE2's VAE and sidecars). - YuE2's On Device row now lists its three packages. It used to list the raw GGUF files, VAE included. - **Refusals.** - With nothing loaded, the refusal now reads the cards' current free memory. It states "and the most free on one GPU is N GB", and the smaller-variant suggestions only list variants that fit. Before, both relied on post-handoff accounting, which is empty in that case. - The two figures use two decimals when one decimal would print the same number twice ("needs about 9.51 GB ... 9.50 GB free"). ## Verification Live on an RTX 3090 (Ampere, like the 10 GB RTX 3080 in unslothai#16627). A blocker process held memory so that Studio saw 9.5 GiB free. Each model was loaded through `/api/inference/load` and ran its worst workflow through `/api/inference/audio/run`. The picker number came from `/api/models/gguf-variants` on the same Studio. | Model | main's estimate | Picker shows | Result at 9.5 GiB free | |---|---|---|---| | ACE-Step Q8_0 (turbo, base) | 15.90 | 12.2GB to run | Refused, "needs about 12.2 GB ... the most free on one GPU is 9.5 GB" | | ACE-Step BF16 | 24.99 | 16.4GB to run | Refused, "needs about 16.4 GB" | | YuE2 Q4_0 | 8.33 | 7.7GB to run | 360 s song, 6.60 GiB peak | | YuE2 Q8_0 | 12.05 | 9.5GB to run | Refused, "needs about 9.51 GB ... 9.50 GB"; at 9.6 GiB free, 360 s song, 8.09 GiB peak | | YuE2 BF16 | 19.03 | 12.9GB to run | Refused, "needs about 12.9 GB ... the most free on one GPU is 9.5 GB", suggests only Q4_0 (~7.7 GB) | | Stable Audio Small Music / SFX Q8_0 | 5.42 | 3.5GB to run | 4 takes at 120 s, 2.24 GiB peak | | Stable Audio Small Music / SFX F16 | 6.99 | 4.6GB to run | 4 takes at 120 s, 2.80 GiB peak | | Stable Audio Medium Q8_0 | 9.84 | 6.7GB to run | 4 takes at 240 s, 5.27 GiB peak | | Stable Audio Medium F16 | 15.08 | 10.4GB to run | Refused, "needs about 10.4 GB" | | HeartMuLa Q8_0 | 19.33 | 20.5GB to run | Refused, "needs about 20.5 GB" | | MiDashengLM-Gen Q8_0 | 9.37 | 5.4GB to run | 3.93 GiB peak | The picker number matches the refusal on every row. Before (unslothai#16628) and after (this PR) on the Create music page, each from its own fresh install with a Hugging Face cache holding only YuE2. In the picker shots the browser was told the card has 10 GB; the refusal ran on the RTX 3090 with 9.4 GB free.     Tests: - Backend: new tests cover each profile against its measured peak, the YuE2 card rule (including an unreadable capability query), the estimate on variant and catalog rows, the package catalog size and smallest variant, YuE2's On Device listing, the refusal with nothing loaded, the two-decimal message, the catalog estimate read off the event loop, and no estimate for dictation, CPU-only runtimes and quants, or hosts the check does not size. The audio, music, TTS, variant-listing and GPU suites pass, except `test_delete_impact_of_a_folder_row_counts_only_its_files`, which reads the local Hugging Face cache and fails the same way on main, and two CUDA numerics tests in the diffusion and video suites that don't use the changed code. - Frontend: new tests cover the fit from the estimate, the "fits on device" filter and row badge on 6, 8 and 10 GiB cards, the recommended quant, the "to run" token, the largest card on a mixed host, and the CPU RAM fallback. Typecheck passes. The full suite has 7 failures, the same ones main has (`context-window-visible`, `estimate-chat-tokens`, `memory-estimate-narrow-panel`, `memory-fit`). Not covered: - A real T4, Hopper, Blackwell, a discrete AMD card and Intel GPUs. - ControlFoley, the MiniMax Music 3 GGUF, HeartMuLa F16 and MiDashengLM-Gen F32, which keep the generic audio.cpp formula. The native MiniMax Music 3 pipeline keeps its fixed 23 GiB estimate. - Pinned-quant rows, which still show only the file size. - ROCm hosts where the installed torch has no kernels for one card, and MIG slices. The picker counts the whole card there, and the load check refuses with the variants that fit. On the Radeon 8060S (an integrated GPU), YuE2 Q4_0 and BF16 hung the GPU ("context is lost ... hard recovery"). That's a separate audio.cpp issue. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
… peaks on each runtime backend (unslothai#16984) Most audio.cpp models in the catalog had no measured profile, so Studio sized them with the generic `weights × 2.5 + 1.5` formula. On NVIDIA that refuses models that fit (unslothai#16627). On AMD, which runs audio.cpp's Vulkan build, several popular models peak above it, so Studio lets them load and they run out of memory partway through generation. This came from [a Reddit report](https://www.reddit.com/r/unsloth/comments/1xkfj98/comment/19s7d0d551gcj/?context=1). After v0.1.915-beta (unslothai#16514) fixed Voxtral and Higgs Audio v3 for that user, BreezeTTS 2 Q4_0 (3.8 GB) was still refused on their 8 GB card. Its estimate was 10.3 GB; on CUDA it is now 7.1 GB. ## Changes - **Profiles from measured peaks** for BreezeTTS 2, Qwen3-TTS, MiniMax Music 3 GGUF, OmniVoice, CosyVoice3 and MOSS-TTS v1.5. Chatterbox, Higgs Audio v3, Kokoro, VoxCPM2 and Voxtral TTS are remeasured with every variant and longer inputs. - **A profile per runtime backend.** The same input peaks 0.5 to 4 GiB higher on audio.cpp's Vulkan build than on CUDA. `estimate_resident_gb` reads the installed runtime's backend and uses the CUDA profile on NVIDIA and the Vulkan one on AMD. With no runtime installed yet, or another build, it takes the larger. This also applies to the music families from unslothai#16628 and unslothai#16726, so YuE2 Q8_0 (9.23 GB) and Stable Audio 3 Medium F16 (9.32 GB) fit the 10 GB card from unslothai#16627 on NVIDIA. - **A fallback per backend** for families not measured yet. CUDA keeps `weights × 2.5 + 1.5`, and Vulkan gets `weights × 1.85 + 4.5`. VibeVoice, whose peak keeps growing with the input, keeps the former everywhere. - I chose each line to minimize expected user frustration across common card sizes, counting a load that runs out of memory as ten refusals. I checked them by fitting on all the measured families but one and scoring the held-out one, for each family in turn. - On Vulkan the new line has fewer crashes and a lower total cost (held-out cost 0.29 against 0.33). - On CUDA a lower line would save some refusals but makes one held-out family run out of memory, so CUDA keeps its fallback. - Transcription models are untouched: their loads never use this estimate. ## Measurements Peak memory of the audio.cpp v0.9.3 server process, with Studio's default options. CUDA was measured on an RTX 3090 and an RTX 6000 Ada. Vulkan was measured on the 3090 and on a Radeon 8060S through AMD DevLab. TTS runs used 30 s references and text past several chunks, or to the default generation cap (Qwen3-TTS, OmniVoice, Higgs); music ran each workflow at its cap. A raised token cap can grow caches past these figures. Every measured variant, with its package size, values in GiB. "(low)" marks where main was below the peak plus the 0.9 GiB margin every profile keeps. | Model | Package | CUDA peak | Vulkan peak | main | CUDA now | Vulkan now | |---|---|---|---|---|---|---| | ACE-Step 1.5 | 5.76 | 11.19 | 11.22 | 12.18 | 12.11 | 12.18 | | ACE-Step 1.5 | 9.40 | 14.74 | 15.31 | 16.36 | 15.67 | 16.36 | | BreezeTTS 2 | 3.53 | 5.50 | 6.83 | 10.33 | 7.12 | 12.10 | | BreezeTTS 2 | 4.15 | 6.12 | 8.39 | 11.88 | 7.46 | 12.10 | | BreezeTTS 2 | 4.73 | 6.87 | 11.18 | 13.33 | 7.78 | 12.10 | | BreezeTTS 2 | 6.84 | 8.00 | 9.79 | 18.60 | 8.94 | 12.10 | | Chatterbox | 1.95 | 5.16 | 4.82 | 5.45 (low) | 6.08 | 5.74 | | Chatterbox | 3.49 | 5.23 | 5.19 | 6.99 | 6.15 | 6.12 | | CosyVoice3 | 2.10 | 3.08 | 4.73 | 6.76 | 4.08 | 5.64 | | CosyVoice3 | 6.51 | 5.81 | 7.36 | 17.79 | 6.73 | 8.29 | | HeartMuLa | 7.13 | 18.40 | 19.58 | 20.54 | 19.31 | 20.53 | | Higgs Audio v3 | 4.75 | 6.19 | 6.47 | 6.75 (low) | 7.14 | 7.45 | | Higgs Audio v3 | 7.92 | 9.40 | 9.55 | 21.30 | 10.32 | 10.46 | | Kokoro | 0.18 | 2.41 | 2.99 | 3.68 (low) | 3.65 | 3.91 | | Kokoro | 0.20 | 2.39 | 2.12 | 3.70 | 3.65 | 3.91 | | Kokoro | 0.87 | 2.41 | 3.05 | 4.37 | 3.65 | 3.98 | | MiDashengLM-Gen | 3.15 | 3.93 | 4.42 | 5.40 | 4.84 | 5.40 | | MiniMax Music 3 | 7.87 | 13.08 | 14.00 | 21.16 | 14.00 | 14.92 | | MiniMax Music 3 | 12.61 | 16.35 | 17.26 | 33.02 | 17.32 | 18.24 | | MOSS-TTS v1.5 | 8.62 | 7.79 | 10.34 | 23.05 | 8.93 | 11.25 | | MOSS-TTS v1.5 | 12.28 | 11.25 | 12.60 | 32.20 | 12.41 | 14.91 | | MOSS-TTS v1.5 | 19.13 | 18.00 | 20.58 | 49.34 | 18.92 | 21.76 | | OmniVoice | 1.26 | 4.44 | 6.82 | 4.64 (low) | 5.35 | 7.73 | | OmniVoice | 1.53 | 3.96 | 4.92 | 5.32 (low) | 5.37 | 7.75 | | Qwen3-TTS | 1.85 | 5.88 | 9.18 | 6.13 (low) | 7.22 | 10.91 | | Qwen3-TTS | 2.34 | 6.36 | 9.66 | 7.36 (low) | 7.95 | 11.45 | | Qwen3-TTS | 2.51 | 6.73 | 9.50 | 7.77 (low) | 8.20 | 11.63 | | Qwen3-TTS | 2.62 | 7.47 | 10.84 | 8.06 (low) | 8.38 | 11.76 | | Qwen3-TTS | 3.89 | 8.85 | 12.20 | 11.23 (low) | 10.28 | 13.15 | | Qwen3-TTS | 3.92 | 8.11 | 12.06 | 11.29 (low) | 10.31 | 13.18 | | Qwen3-TTS | 4.23 | 8.20 | 11.49 | 12.08 (low) | 10.79 | 13.53 | | Stable Audio 3 | 1.57 | 2.24 | 2.01 | 3.47 | 3.52 | 3.47 | | Stable Audio 3 | 2.20 | 2.80 | 2.54 | 4.60 | 4.46 | 4.60 | | Stable Audio 3 | 3.34 | 5.27 | 5.34 | 6.66 | 6.18 | 6.66 | | Stable Audio 3 | 5.43 | 7.30 | 9.48 | 10.43 | 9.32 | 10.43 | | VoxCPM2 | 2.75 | 8.62 | 8.94 | 10.75 | 10.75 | 10.75 | | VoxCPM2 | 4.45 | 11.09 | 11.15 | 14.48 | 14.48 | 14.48 | | VoxCPM2 | 4.62 | 11.09 | 13.11 | 14.86 | 14.86 | 14.86 | | VoxCPM2 | 8.89 | 19.06 | 22.36 | 24.26 | 24.26 | 24.26 | | Voxtral TTS | 4.40 | 5.31 | 5.92 | 6.40 (low) | 6.40 | 6.84 | | Voxtral TTS | 7.48 | 8.38 | 11.15 | 20.20 | 9.48 | 12.07 | | YuE2 | 2.73 | 6.78 | 6.52 | 7.73 | 7.69 | 7.73 | | YuE2 | 4.22 | 8.27 | 8.58 | 9.52 | 9.23 | 9.52 | | YuE2 | 7.01 | 11.19 | 11.87 | 12.86 | 12.10 | 12.86 | Two profiles sit above the tightest fit on purpose: - **Qwen3-TTS on CUDA** is steeper, so 0.6B Q8_0 stays at 7.2 GB and loads on an 8 GB card. - **VoxCPM2 and Kokoro** also cover unslothai#16514's whole-device peaks (VoxCPM2 9.66 and 13.31 GiB, Kokoro 2.74 GiB). ## Not changed here - Chatterbox convert grows with the source: 12.7 GiB at 60 s, out of memory at 120 s, yet Studio allows 300 s. The profile covers sources up to 30 s. - VoxCPM2 clone fails with references of 15 s or more; Studio allows 30 s. - Higgs Audio v3 stops at its 2,048-token chunk cap on long text. - Kokoro multilingual stops resolving when it is the only Kokoro file in the cache. - MiniMax Music 3 BF16 was not measured and keeps the generic formula. ## Tests - New tests check every measured variant against its CUDA and Vulkan peak with the margin, the profile and fallback for each backend (CUDA, Vulkan, none, other) and YuE2's placement on the unslothai#16627 card under each backend. The estimate tests pin the backend, so the installed runtime doesn't affect them. - The audio, music, TTS and variant-listing suites pass. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Part of #16627.
Problem
On the Create music page, the model list shows each variant's file size, but the audio.cpp pre-load check (
_preflight_native_audio_placement) refuses a model by its resident estimate fromestimate_resident_gb. ACE-Step and Yue2 have no measured profile, so they get the genericfile_GiB * 2.5 + 1.5formula: ACE-Step turbo Q8_0 (6.2 GB file) is sized at ~15.9 GB and Yue2 Q8_0 (4.5 GB) at ~12.1 GB. The refusal said only "No single GPU has enough free memory", so a 6.2 GB model refused on a 10 GB card looked like a bug.It also suggested a "smaller variant" that can't help.
smaller_variantscompared raw byte sizes, and ACE-Stepbase/Q8_0is 1,152 bytes smaller thanturbo/Q8_0, so a refused turbo Q8_0 load suggestedQ8_0 · base (~15.9 GB), the same estimate it had just refused. That's the error in the report.Change
classify_audio_cpp_failuretakesrequired_gb. A placement refusal now states it, plus the most free memory on one GPU when that's known: "No single GPU has enough free memory for ACE-Step1.5-GGUF. It needs about 12.2 GB of GPU memory while running. Free GPU memory, ...". The preflight passes the estimate it compared.smaller_variantsskips variants whose estimate isn't lower than the refused model's.ACE-Step gets a measured profile,
weights_GiB * 1.0 + 6.4, in place of the generic* 2.5 + 1.5. That puts turbo/base Q8_0 at 12.2 GB (was 15.9) and BF16 at 15.8 GB (was 25.0).Peak GPU memory, sampled through NVML every 50 ms while Studio's own
AudioCppBackendloaded the model and generated through audio.cpp v0.9.3 CUDA (fresh process per row):The profile covers the worst row, a 240 s cover, with at least 0.9 GiB of headroom, as the other profiles do. A 10 GB card is still refused for Q8_0: a full-length cover really needs about 11.2 GiB.
Yue2 stays on the generic formula. Its peak depends a lot on the GPU: Q4_0 / Q8_0 / BF16 peaked at 6.95 / 9.99 / 11.24 GiB on a T4, but Q4_0 / Q8_0 only at 4.45 / 5.99 GiB on an L4 (songs of about 3 minutes). The generic estimate (8.3 / 12.1 / 19.0 GB) covers the T4 with 1.4 to 2 GiB to spare, and a self-ending song can run to 6 minutes, so lowering it isn't safe without an estimate that knows the GPU.
Testing
test_audio_cpp_failures.py: no same-size sibling suggested (real ACE-Step1.5-GGUF byte sizes), and the refusal text with and without free memory. The route test intest_audio_cpp_failure_routes.pynow checks the stated estimate and free memory. All 52 tests in those two files pass.POST /api/inference/validateon the inference router with real catalog entries resolved from the Hub. Onlymodel_runtime_problemwas patched, because audio.cpp isn't installed on this machine.git archiveof main (c15435d). Results match except for the 2 new passing tests. The remaining failures and collection errors happen on main too, and they come from this machine (missing torch/fastmcp/soundfile in that Python, no symlink privilege).Not covered: ROCm, XPU, Vulkan and Metal peaks (measurements are CUDA only, like the existing profiles); Yue2 BF16 on an Ampere or newer card; a Yue2 song longer than about 3 minutes.