Views
No views yet
cfg_weight scalar input combines cond and uncond logits inside the
graph; callers don't need to run the LM twice. Matches the behaviour of the
PyTorch model.AlignmentStreamAnalyzer and force EOS
on short utterances. Fixes the trailing-speech hallucinations reported in
resemble-ai/chatterbox#97.ScatterND ops are replaced with Where/Gather/
Concat patterns throughout, allowing ONNX Runtime to capture the decode
loop as a CUDA graph..onnx graph has an accompanying .onnx_data sidecar (ONNX external
data format). Keep them together when downloading.| File | Purpose |
|---|---|
embed_tokens_v2.onnx | Token + position + exaggeration → embeddings (batch=2 CFG-ready, scatter-free) |
language_model_v2.onnx | T3 Llama backbone with CFG + alignment attention, fp16 (~1 GB) |
conditional_decoder_n4.onnx | S3Gen vocoder, 4 CFM Euler steps (fastest) |
conditional_decoder_n6.onnx | S3Gen vocoder, 6 CFM Euler steps (balanced, default) |
conditional_decoder_n10.onnx | S3Gen vocoder, 10 CFM Euler steps (highest quality) |
speech_encoder.onnx from
onnx-community/chatterbox-multilingual-ONNX
is reused as-is (single-shot on the reference audio, not on the hot path).chatterbox_multi_inference_script.run_inference(...) that
drives the four graphs end-to-end. Minimal sketch:1import onnxruntime as ort
2from huggingface_hub import hf_hub_download
3
4repo = "hugbos/chatterbox-multilingual-ONNX-v2"
5for name in ("embed_tokens_v2", "language_model_v2", "conditional_decoder_n6"):
6 hf_hub_download(repo_id=repo, filename=f"{name}.onnx")
7 hf_hub_download(repo_id=repo, filename=f"{name}.onnx_data")
8
9providers = ["CUDAExecutionProvider", "CPUExecutionProvider"]
10lm = ort.InferenceSession("language_model_v2.onnx", providers=providers)
11# ... drive LM with (inputs_embeds, attention_mask, cfg_weight, past_key_values.*)
12# ... consume (logits, attn_layers, present.*) per steponnxruntime-gpu 1.24, warm measurements:| Backend | Latency (mean, full WAV) | Time-to-first-audio |
|---|---|---|
PyTorch BF16 (upstream ChatterboxMultilingualTTS) | 3.00 s | 3.00 s |
| ONNX v2 (this export) | 1.68 s | 1.68 s (one-shot) |
| ONNX v2 + chunked streaming | 2.05 s | 610 ms |
language_model.onnx + sidecar totals ~1 GB fp16. Cold
InferenceSession creation is 5–15 s on NVMe.chatterbox_to_onnx_conversion_script.export_model_to_onnx(multilingual=True, ...).1@misc{chatterbox,
2 author = {Resemble AI},
3 title = {Chatterbox: multilingual expressive TTS},
4 year = {2025},
5 url = {https://github.com/resemble-ai/chatterbox}
6}