Skip to content

Studio: size audio.cpp TTS models from measured peaks and run TQ2_1 on the CPU - #16514

Merged
oobabooga merged 6 commits into
unslothai:mainfrom
oobabooga:worktree-audio-cpp-vram-estimate
Nov 3, 2026
Merged

oobabooga merged 6 commits into
unslothai:mainfrom
oobabooga:worktree-audio-cpp-vram-estimate

Conversation

@oobabooga

Copy link
Copy Markdown
Member

Reported on Reddit: Bug with TTS on Unsloth Desktop.

On an 8 GB GPU, the Audio page refuses several TTS models with "No single GPU has enough free memory", so they only run in CPU RAM, although they fit on the GPU. Two related problems on the same path: some models pass that check and then run out of memory mid-generation, and the 2-bit KittenTTS2 variant crashes the audio runtime on any NVIDIA GPU.

Causes

One size formula for every family

Before an audio.cpp load, _preflight_native_audio_placement sizes the model with estimate_resident_gb, which is file_GiB * 2.5 + 1.5 for every family. That matches Qwen3-TTS at its 8192-token cap. Other families are far from it, in both directions:

Model File Estimate Measured peak
Qwen3-TTS 1.7B q8_0 2.62 GiB 8.06 GiB 7.50 GiB
Voxtral 4B TTS q8_0 4.40 GiB 12.50 GiB 5.31 GiB
Higgs Audio v3 4B q8_0 4.75 GiB 13.36 GiB 5.68 GiB
Chatterbox f16 3.49 GiB 10.22 GiB 4.66 GiB
Chatterbox q8_0 1.94 GiB 6.36 GiB 4.15 GiB
Kokoro q8_0 0.18 GiB 1.94 GiB 2.74 GiB
VoxCPM2 q8_0 2.75 GiB 8.38 GiB 9.66 GiB
VoxCPM2 bf16 4.44 GiB 12.61 GiB 13.31 GiB

Each peak is the largest device memory use while generating from a ~1,250-word input, sampled through NVML on audio.cpp v0.9.3 (CUDA). VoxCPM2's peak stops growing after about 3 minutes of speech.

TQ2_1 crashes on CUDA

KittenTTS2's tq2_1 file uses audio.cpp's ternary type 44, which upstream documents as CPU-only ("not a CUDA/Vulkan/Metal package"). On a GPU, the server aborts at the first matmul:

ggml-cuda.cu:1806: GGML_ASSERT(to_fp16_cuda != nullptr) failed

Studio still started it on CUDA on Auto, and its quant regex did not recognize tq2_1, so the variant was listed as "1".

Fix

  • Per-family estimates. estimate_resident_gb takes the model family and uses a measured profile, weights * per_weight + fixed, for Chatterbox, Higgs Audio v3 and Voxtral (lower) and Kokoro and VoxCPM2 (higher). Each profile is the measured peak plus at least 0.9 GiB of headroom. Other families keep the existing formula. Above the largest package measured for a family, the estimate is the larger of its profile and the generic formula. The preflight and the smaller-variant suggestions in the out-of-memory error both use it.
  • CPU-only packages. A TQ2_1 variant reports cpu_only, and audio_load_runs_on_cpu treats it like a CPU-only runtime. Auto therefore runs it on the CPU in the preflight (no VRAM sizing), in the orchestrator (audio_device = "cpu" to the worker), and in the already-loaded check (a new audio_cpu_only flag on the resident entry). AudioCppServer.start never picks a GPU backend for it, whatever the caller. The quant regex now recognizes tq, so the variant is listed as TQ2_1.

Scope

  • VibeVoice is deliberately not listed. Its peak grows with the input (5.7 GiB on ~300 words, 12 GiB on ~1,250), so no load-time estimate covers it, including the current 9 GiB one.
  • Qwen3-TTS keeps the generic formula, which matches its worst case. On an 8 GB card, Qwen3-TTS 1.7B q8_0 is still refused.
  • A CPU-only package also runs on the CPU when the device is pinned to GPU, as a CPU-only runtime already does. The Audio page shows no separate notice for it.

Verification

Live A/B on one RTX 6000 Ada, base 073f6e0cc7 against this branch, loading through /api/inference/load and generating through /api/inference/audio/run from a ~1,250-word input. A blocker process held memory so Studio saw the listed free memory.

Case main This branch
Voxtral 4B q8_0, 7.30 GiB free Refused Loads on GPU and completes
Higgs Audio v3 4B q8_0, 7.30 GiB free Refused Loads on GPU and completes
Chatterbox f16, 7.30 GiB free Refused Loads on GPU and completes
Qwen3-TTS 1.7B q8_0, 7.30 GiB free Refused Refused
VibeVoice 1.5B q8_0, 7.30 GiB free Refused Refused
Kokoro q8_0, 2.40 GiB free Loads, then generation fails to allocate Refused before loading
VoxCPM2 q8_0, 9.50 GiB free Loads, then generation fails to allocate Refused before loading
VoxCPM2 q8_0, 11.30 GiB free Completes Completes
KittenTTS2 TQ2_1, Auto Loads on CUDA, then runtime_stopped (3 of 3) Runs on CPU, 4 of 4 succeed (about 28 s for 11.3 s of audio)

KittenTTS2 q4_0 and q8_0 run on CUDA in both arms. On the 7.30 GiB card, main's only option for Voxtral is CPU: the same short input took a median of 58.3 s there against 1.09 s on the GPU with this branch (four interleaved runs each).

Tests: the new and updated tests in test_audio_cpp_failures.py, test_audio_cpp_failure_routes.py and test_audio_cpp_cpu_only_packages.py cover the profiles, preflight placement, the CPU-only path through a stubbed-worker InferenceOrchestrator.load_model, and the server backend choice (61 passed; 18 fail against main). The audio, TTS, orchestrator and GPU-selection suites: 2855 passed, 1 failed (test_delete_impact_of_a_folder_row_counts_only_its_files, which also fails on main because it reads the local Hugging Face cache).

Not covered: ROCm, XPU and Vulkan backends, and families not in the tables.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 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 ⚠️ Failed 2026-11-03T01:55:32.744987Z
We couldn’t complete this review. Comment @codex review to try again.
228e7c2 PR opened
ℹ️ 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.

@oobabooga

Copy link
Copy Markdown
Member Author

Reached Codex review convergence at oobabooga#452.

@oobabooga
oobabooga merged commit 28f3e5d into unslothai:main Nov 3, 2026
danielhanchen pushed a commit to Etherll/unsloth that referenced this pull request Nov 7, 2026
… 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants