File size: 21,366 Bytes
f547c0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1a11126
 
 
 
 
 
 
 
 
 
 
a7f9414
 
 
 
 
 
 
 
 
 
 
f547c0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
---
base_model: fishaudio/s2-pro
base_model_relation: quantized
license: other
license_name: fish-audio-research-license
license_link: LICENSE.md
pipeline_tag: text-to-speech
library_name: onnx
tags:
- onnx
- moonbox
- onnxruntime
- onnxruntime-genai
- fish-audio
- fish-speech
- s2-pro
- text-to-speech
- voice-cloning
- multilingual
- non-commercial
---

# Fish Audio S2 Pro ONNX

ONNX builds of [Fish Audio S2 Pro](https://huggingface.co/fishaudio/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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`](https://huggingface.co/moonbox-dev/s2-pro-ONNX/blob/main/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) and `present.*`.
- `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 far `codes` [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's `encode_for_inference` token 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:

```bash
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
```

```python
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](https://huggingface.co/fishaudio/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

<img src="overview.png" alt="Fish Audio S2 Pro overview — fine-grained control, multi-speaker multi-turn generation, low-latency streaming, and long-context inference." width="100%">

[**Technical Report**](https://huggingface.co/papers/2603.08823) | [**GitHub**](https://github.com/fishaudio/fish-speech) | [**Playground**](https://fish.audio)

**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

- [Fish Speech GitHub](https://github.com/fishaudio/fish-speech)
- [Fish Audio Playground](https://fish.audio)
- [Blog & Tech Report](https://fish.audio/blog/fish-audio-open-sources-s2/)

## Technical Report

If you find our work useful, please consider citing our report:

```bibtex
@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](LICENSE.md). Research and non-commercial use is permitted free of charge. Commercial use requires a separate license from Fish Audio — contact business@fish.audio.