Repository navigation
Studio: size more audio.cpp music models from measured peaks and show the load estimate in the picker - #16726
Conversation
…y on every estimate
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3994403e8
ℹ️ 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".
| gpu: { available: boolean; maxDeviceMemoryGb: number }, | ||
| cpuLoad = false, | ||
| ): number { | ||
| return gpu.available && !cpuLoad ? gpu.maxDeviceMemoryGb : 0; |
There was a problem hiding this comment.
Exclude ROCm GPUs rejected by the placement check
On a heterogeneous ROCm host where the larger card lacks kernels in the installed PyTorch wheel, useGpuInfo() still enumerates that card and includes it in maxDeviceMemoryGb. The additional evidence beyond the fixed CUDA/Vulkan-inventory case is auto_select_gpu_ids()'s rocm_gpu_ids_without_torch_kernels() exclusion: it removes those cards before ranking and every fallback, while _probe_backend_visible_gpu_info() does not. With an eligible 8 GiB card and an excluded 16 GiB card, this helper makes YuE2 BF16 (12.86 GiB) read fits and become recommended, but _preflight_native_audio_placement() refuses it; only Q4_0 fits the eligible card. Derive the capacity from the same architecture-filtered device set as the loader.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this. It needs a mixed-architecture ROCm host whose larger card has no kernels in the installed torch wheel, and main's file-size rule reads YuE2 BF16 as fitting there too, so it is not a regression. The load check stays the authority and refuses with the variants that fit. Mirroring each eligibility filter of auto_select_gpu_ids (kernel coverage, MIG slices, parent visibility) in the picker is out of scope here; the picker sizes on the torch inventory the loader starts from.
|
Codex Review: Didn't find any major issues. Swish! 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". |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
… 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>
Follow-up to #16628. Fixes #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 #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_serverprocess 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:
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
_MEASURED_PROFILES:stable_audio,midashenglm_gen,heartmulaandyue2are new.ace_stepbecomesweights * 1.15 + 5.55, so BF16 keeps the margin on Vulkan and Q8_0 stays at about 12.2 GiB.estimated_resident_gb, computed withestimate_resident_gbon 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.Verification
Live on an RTX 3090 (Ampere, like the 10 GB RTX 3080 in #16627). A blocker process held memory so that Studio saw 9.5 GiB free. Each model was loaded through
/api/inference/loadand ran its worst workflow through/api/inference/audio/run. The picker number came from/api/models/gguf-variantson the same Studio.The picker number matches the refusal on every row.
Before (#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:
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.context-window-visible,estimate-chat-tokens,memory-estimate-narrow-panel,memory-fit).Not covered:
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.