Instructions to use moonbox-dev/s2-pro-ONNX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ONNX Runtime GenAI
How to use moonbox-dev/s2-pro-ONNX with ONNX Runtime GenAI:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Fish Audio S2 Pro ONNX
ONNX builds of Fish Audio S2 Pro, made by Moonbox for on-device use with ONNX Runtime (CPU, CUDA, DirectML). Each
precision is one folder holding the graphs and a small Python pipeline.py that does the rest (features, prompt,
sampling loop); what the graphs take and return is under How to run.
Files
The last column is the benchmark on Moonbox's TTS set (voice cloning of English and Chinese sentences from a LibriSpeech and an AISHELL-1 prompt; details under How to run): error rate of a Whisper transcript against the text, speaker similarity to the prompt and DNSMOS, against the original PyTorch model.
| Precision | File | Size | sha256 | Benchmark |
|---|---|---|---|---|
| fp16 | fp16/codec_dec.onnx |
740.2 MB | 095b0a29cca1 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/codec_enc.onnx |
832.0 MB | ba47cacf744f |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/decoder.onnx |
0.3 MB | c24505c9ed23 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/decoder.onnx.data |
7.28 GB | 6f6bfbd82d07 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/embed.onnx |
1.01 GB | ad0022d30456 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/fast.onnx |
849.6 MB | 3c133d6c1c02 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/head.onnx |
21.0 MB | 18c9dc13e368 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/pipeline.py |
11.7 kB | 6175d1338626 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/special_tokens_map.json |
0.1 MB | c2ff18fde6e4 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/tokenizer.json |
12.2 MB | f24e08099d45 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| fp16 | fp16/tokenizer_config.json |
0.9 MB | b8d149343ae4 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.0, bf16), similarity 0.961 / 0.946 (0.958 / 0.945), DNSMOS 3.27 / 2.83 (3.28 / 2.62); RTF 1.90 (CUDA) |
| int8 | int8/codec_dec.onnx |
188.3 MB | 2ff21755871d |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/codec_enc.onnx |
832.0 MB | ba47cacf744f |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/decoder.onnx |
0.4 MB | 75ebe7c93987 |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/decoder.onnx.data |
3.87 GB | 3baa04b0f2cb |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/embed.onnx |
504.4 MB | 432b4c11b571 |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/fast.onnx |
849.6 MB | 3c133d6c1c02 |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/head.onnx |
21.0 MB | 18c9dc13e368 |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/pipeline.py |
11.7 kB | 6175d1338626 |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/special_tokens_map.json |
0.1 MB | c2ff18fde6e4 |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/tokenizer.json |
12.2 MB | f24e08099d45 |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int8 | int8/tokenizer_config.json |
0.9 MB | b8d149343ae4 |
slow AR 8-bit: WER 0.0 % / CER 0.3 %, similarity 0.958 / 0.941, DNSMOS 3.26 / 2.68; RTF 1.63 (CUDA) |
| int4 | int4/codec_dec.onnx |
188.3 MB | 2ff21755871d |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/codec_enc.onnx |
832.0 MB | ba47cacf744f |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/decoder.onnx |
0.4 MB | 42fc4e327191 |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/decoder.onnx.data |
2.05 GB | 2fee2bd872d7 |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/embed.onnx |
504.4 MB | 432b4c11b571 |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/fast.onnx |
849.6 MB | 3c133d6c1c02 |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/head.onnx |
21.0 MB | 18c9dc13e368 |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/pipeline.py |
11.7 kB | 6175d1338626 |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/special_tokens_map.json |
0.1 MB | c2ff18fde6e4 |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/tokenizer.json |
12.2 MB | f24e08099d45 |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
| int4 | int4/tokenizer_config.json |
0.9 MB | b8d149343ae4 |
slow AR 4-bit: WER 0.0 % / CER 0.0 %, similarity 0.956 / 0.941, DNSMOS 3.19 / 2.78; RTF 1.53 (CUDA) |
How to run
Built with Fish Audio. These files are licensed under the Fish Audio Research License (Copyright Β© 39 AI, INC.,
copied here as LICENSE.md): research and non-commercial use only; commercial use needs a license from Fish Audio.
NOTICE.md says what was changed.
Fish Audio S2 Pro (4.4B dual-autoregressive TTS: voice cloning from a few seconds of reference audio and its
transcript, 80+ languages, 44.1 kHz output) as ONNX graphs plus pipeline.py, a numpy runtime that reproduces the
official generate_long(text, prompt_text=[ref_text], prompt_tokens=[codes]) (fish-speech @0f8a12e) around them.
decoder.onnx: the 36-layer slow transformer as a Qwen3 decoder (onnxruntime-genai's model builder):inputs_embeds[1, S, 2560],attention_mask,past_key_values.{0..35}.key / .value[1, 8, past, 128] ->hidden_states[1, S, 2560] (after the final norm) andpresent.*.embed.onnx: frames of the prompt,codes[1, 11, S] (the token id and the 10 codebooks) ->inputs_embeds: the token embedding, plus the summed codebook embeddings, scaled by 1 / sqrt(11) on audio frames.head.onnx:hidden[1, 2560] ->logits[1, 4097]: the 4096 semantic tokens and<|im_end|>(index 4096), the only tokens the official constrained decoding allows.fast.onnx: the 4-layer fast transformer:hidden[1, 2560] and the codebooks so farcodes[1, J] ->logits[1, 4096] of codebook J. No cache: a frame has 10 positions.codec_enc.onnx/codec_dec.onnx: the codec: 44.1 kHz audio [1, 1, 2048 N] <-> codes [1, 10, N].
Two changes keep fp16 in range; neither changes the outputs. The slow transformer has massive activations: its residual
stream reaches ~6e4 from layer 6 on, at fp16's limit, and an fp16 build gave noise. In decoder.onnx the residual
stream is divided by 8 (v_proj, up_proj and the input embeddings by 8, the RMSNorm epsilon by 64). RMSNorm
ignores the scale of its input, so the hidden states are those of the original (cosine 0.9999 to the original in
float32, against 0.9998 for the original's own bfloat16 run). The fast transformer's RMSNorms compute on x / 64, since
x * x overflows fp16 there.
pipeline.py does the rest in numpy:
- the prompt: torchaudio's resampler to 44.1 kHz, the codec, and the official conversation (system: instruction,
reference text with
<|speaker:0|>, reference codes; user: the text; assistant:<|voice|>), with the publisher's tokenizer (tokenizers,tokenizer.json). It matches fish-speech'sencode_for_inferencetoken for token; - the official sampling: temperature 0.7, top-p 0.7, top-k 30. When a semantic token repeats one of the last 10 frames' tokens, it falls back to a second sample at temperature 1.0 / top-p 0.9. At most 1024 frames;
- the codec decoder.
It needs numpy, onnxruntime-gpu (or onnxruntime), tokenizers and soundfile:
python fp16/pipeline.py "The quick brown fox jumps over the lazy dog." out.wav --ref voice.wav \
--ref-text "Exactly what is said in voice.wav." --cuda --seed 0
import sys, soundfile as sf
sys.path.insert(0, "int4")
import pipeline
tts = pipeline.FishS2Pro("int4", "cuda")
ref, sr = sf.read("voice.wav", dtype="float32")
wav, out_sr = tts("Text to say.", ref, sr, "Transcript of voice.wav.", seed=0) # 44.1 kHz
The whole text is one generation, as in the official code without speaker tags (no chunking). Sampling uses numpy's
generator, so a seed gives the same speech every run here, not the same speech as PyTorch with that seed. Run on CUDA:
the slow transformer is 7.3 GB in fp16, and on the CPU every frame is 11 runs of ONNX graphs. On Windows, give CUDA
sessions the run option memory.enable_memory_arena_shrinkage = gpu:0, as pipeline.py does. Every input length
differs, so ONNX Runtime's GPU arena otherwise keeps growing.
Precisions. fp16/: the slow transformer fp16 (builder), the embeddings, head and fast transformer fp16 weights
with fp32 inputs / outputs, the codec fp32. int8/: the slow transformer 8-bit MatMulNBits (block 32), embedding
tables int8 per row, the codec decoder weight-only int8. int4/: the slow transformer 4-bit MatMulNBits (block 32),
the rest as int8/. In int8/ and int4/ the head and the fast transformer stay fp16: weight-only int8 dequantizes
the fast transformer's weights on each of its 9 runs a frame, which made the int8 builds 6x slower. The codec encoder
is fp32 everywhere: in fp16 or int8 its quantizer picks other codes (0-2 % agree). No bf16 build: fp16 passes.
Benchmark. The lab's TTS set: 6 English sentences cloned from a LibriSpeech test-clean prompt and 4 Chinese sentences from an AISHELL-1 prompt, each with seeds 0-3 (40 clips per build), the original's sampling. Sampled speech can't be compared sample by sample, so each build is judged as the original is: Whisper large-v3-turbo's WER (English) or CER (Chinese) against the text, WavLM-base-plus-sv speaker similarity to the prompt, and DNSMOS (P.835 overall). The original is fish-speech @0f8a12e's own inference in bfloat16 on CUDA (its default precision), the codec in bfloat16 as it loads it. Pass (the TTS threshold used across these repositories): per language, error rate at most 2 points above the original's, similarity at most 0.03 below, DNSMOS at most 0.2 below. Real-time factor (processing time / audio time) on an RTX 3080 Laptop GPU (16 GB), whole pipeline; the original runs without torch.compile.
| English WER | similarity | DNSMOS | Chinese CER | similarity | DNSMOS | Real-time factor | |
|---|---|---|---|---|---|---|---|
| original (PyTorch bf16, CUDA) | 0.0 % | 0.958 | 3.28 | 0.0 % | 0.945 | 2.62 | 4.69 |
fp16/ (CUDA) |
0.0 % | 0.961 | 3.27 | 0.0 % | 0.946 | 2.83 | 1.90 |
int8/ (CUDA) |
0.0 % | 0.958 | 3.26 | 0.3 % | 0.941 | 2.68 | 1.63 |
int4/ (CUDA) |
0.0 % | 0.956 | 3.19 | 0.0 % | 0.941 | 2.78 | 1.53 |
Graphs checked against the original modules before the benchmark (largest absolute difference, float32): the slow transformer's first two layers 4e-5 (the official RoPE table is rounded to bfloat16; with it, 0.018 of 35), embeddings 0, head 2e-5, fast transformer 2e-5, codec decoder 4e-6, codec encoder codes identical on noise; on the benchmark's English prompt the fp32 encoder agrees with the original's float32 codes on 100 % of codebook 0 and 95-99 % of the others (the original's own bfloat16 run: 86 % / 22-68 %).
How these were made
From Fish Audio S2 Pro at revision 1de9996b6b. The graphs were exported from the original PyTorch modules with
torch.onnx (opset 17 / 18) and checked against them; language-model decoders were built with onnxruntime-genai's
model builder (inputs_embeds in, KV cache in and out). Weight-only quantization: int8 is a
per-output-channel int8 weight behind DequantizeLinear (or 8-bit MatMulNBits in a text decoder), int4 is ONNX
Runtime's MatMulNBits (block 32). Each card above says which precision every graph uses. Every precision was
benchmarked against the original before upload (pass, per language: error rate at most 2 points above the
original's, speaker similarity at most 0.03 below, DNSMOS at most 0.2 below), and the sha256 column above is what
the files must hash to.
License
other (Fish Audio research license). These files are a derivative of the original model and carry its license: it is copied in this repository, and it governs your use of these files. The original model card follows unchanged.
Original model card
Fish Audio S2 Pro
Technical Report | GitHub | Playground
Fish Audio S2 Pro is a leading text-to-speech (TTS) model with fine-grained inline control of prosody and emotion. Trained on over 10M+ hours of audio data across 80+ languages, the system combines reinforcement learning alignment with a dual-autoregressive architecture. The release includes model weights, fine-tuning code, and an SGLang-based streaming inference engine.
Architecture
S2 Pro builds on a decoder-only transformer combined with an RVQ-based audio codec (10 codebooks, ~21 Hz frame rate) using a Dual-Autoregressive (Dual-AR) architecture:
- Slow AR (4B parameters): Operates along the time axis and predicts the primary semantic codebook.
- Fast AR (400M parameters): Generates the remaining 9 residual codebooks at each time step, reconstructing fine-grained acoustic detail.
This asymmetric design keeps inference efficient while preserving audio fidelity. Because the Dual-AR architecture is structurally isomorphic to standard autoregressive LLMs, it inherits all LLM-native serving optimizations from SGLang β including continuous batching, paged KV cache, CUDA graph replay, and RadixAttention-based prefix caching.
Fine-Grained Inline Control
S2 Pro enables localized control over speech generation by embedding natural-language instructions directly within the text using [tag] syntax. Rather than relying on a fixed set of predefined tags, S2 Pro accepts free-form textual descriptions β such as [whisper in small voice], [professional broadcast tone], or [pitch up] β allowing open-ended expression control at the word level.
Common tags (15,000+ unique tags supported):
[pause] [emphasis] [laughing] [inhale] [chuckle] [tsk] [singing] [excited] [laughing tone] [interrupting] [chuckling] [excited tone] [volume up] [echo] [angry] [low volume] [sigh] [low voice] [whisper] [screaming] [shouting] [loud] [surprised] [short pause] [exhale] [delight] [panting] [audience laughter] [with strong accent] [volume down] [clearing throat] [sad] [moaning] [shocked]
Supported Languages
S2 Pro supports 80+ languages.
Tier 1: Japanese (ja), English (en), Chinese (zh)
Tier 2: Korean (ko), Spanish (es), Portuguese (pt), Arabic (ar), Russian (ru), French (fr), German (de)
Other supported languages: sv, it, tr, no, nl, cy, eu, ca, da, gl, ta, hu, fi, pl, et, hi, la, ur, th, vi, jw, bn, yo, xsl, cs, sw, nn, he, ms, uk, id, kk, bg, lv, my, tl, sk, ne, fa, af, el, bo, hr, ro, sn, mi, yi, am, be, km, is, az, sd, br, sq, ps, mn, ht, ml, sr, sa, te, ka, bs, pa, lt, kn, si, hy, mr, as, gu, fo, and more.
Production Streaming Performance
On a single NVIDIA H200 GPU:
- Real-Time Factor (RTF): 0.195
- Time-to-first-audio: ~100 ms
- Throughput: 3,000+ acoustic tokens/s while maintaining RTF below 0.5
Links
Technical Report
If you find our work useful, please consider citing our report:
@misc{liao2026fishaudios2technical,
title={Fish Audio S2 Technical Report},
author={Shijia Liao and Yuxuan Wang and Songting Liu and Yifan Cheng and Ruoyi Zhang and Tianyu Li and Shidong Li and Yisheng Zheng and Xingwei Liu and Qingzheng Wang and Zhizhuo Zhou and Jiahua Liu and Xin Chen and Dawei Han},
year={2026},
eprint={2603.08823},
archivePrefix={arXiv},
primaryClass={cs.SD},
url={https://arxiv.org/abs/2603.08823},
}
License
This model is licensed under the Fish Audio Research License. Research and non-commercial use is permitted free of charge. Commercial use requires a separate license from Fish Audio β contact business@fish.audio.
Model tree for moonbox-dev/s2-pro-ONNX
Base model
fishaudio/s2-pro