Instructions to use moonbox-dev/Fun-CosyVoice3-0.5B-2512-ONNX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ONNX Runtime GenAI
How to use moonbox-dev/Fun-CosyVoice3-0.5B-2512-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
- CosyVoice
How to use moonbox-dev/Fun-CosyVoice3-0.5B-2512-ONNX with CosyVoice:
# 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
CosyVoice 3 ONNX
ONNX builds of CosyVoice 3, 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/campplus.onnx |
28.3 MB | a6ac6a639977 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/decoder.onnx |
0.1 MB | 1c9e47bfe992 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/decoder.onnx.data |
720.0 MB | b6fd909ffee6 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/f0_predictor.npz |
26.5 MB | 019d7d548514 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/flow_encoder.onnx |
2.2 MB | c8e9811f07e2 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/flow_estimator.onnx |
663.8 MB | d33b08c76f9c |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/flow_noise.npy |
4.8 MB | 1d0e8fbe9796 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/hift.onnx |
329.4 MB | 539b2813b28c |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/lm_head.onnx |
12.1 MB | df323aedb29d |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/mel80_24k.npy |
0.3 MB | 4f1aed49678e |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/pipeline.py |
15.9 kB | 4e50186a8f9a |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/speech_embed.onnx |
12.1 MB | 17d97744cef8 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/speech_tokenizer_v3.onnx |
969.5 MB | 23236a74175d |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/text_embed.onnx |
272.3 MB | 774a039af165 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/tokenizer.json |
10.6 MB | caa0dadcb8c4 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| fp16 | fp16/whisper_mel128.npy |
0.1 MB | 364239f8b565 |
WER 0.0 % / CER 0.0 % (original 0.0 / 0.3, fp32), similarity 0.971 / 0.959 (0.973 / 0.964), DNSMOS 3.24 / 2.80 (3.22 / 2.84); RTF 0.53 (CUDA) |
| int8 | int8/campplus.onnx |
28.3 MB | a6ac6a639977 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/decoder.onnx |
0.2 MB | a99aae751f62 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/decoder.onnx.data |
384.5 MB | d172d8771545 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/f0_predictor.npz |
26.5 MB | 019d7d548514 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/flow_encoder.onnx |
2.7 MB | db70cb6b9337 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/flow_estimator.onnx |
334.7 MB | 0c6385594675 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/flow_noise.npy |
4.8 MB | 1d0e8fbe9796 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/hift.onnx |
329.4 MB | 539b2813b28c |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/lm_head.onnx |
6.1 MB | b2a2a452902c |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/mel80_24k.npy |
0.3 MB | 4f1aed49678e |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/pipeline.py |
15.9 kB | 4e50186a8f9a |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/speech_embed.onnx |
6.1 MB | ec4fa58e761a |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/speech_tokenizer_v3.onnx |
969.5 MB | 23236a74175d |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/text_embed.onnx |
136.7 MB | f4adfc639d51 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/tokenizer.json |
10.6 MB | caa0dadcb8c4 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int8 | int8/whisper_mel128.npy |
0.1 MB | 364239f8b565 |
WER 0.3 % / CER 0.0 %, similarity 0.969 / 0.955, DNSMOS 3.21 / 2.77; RTF 0.56 (CUDA) |
| int4 | int4/campplus.onnx |
28.3 MB | a6ac6a639977 |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/decoder.onnx |
0.2 MB | 7813d4b1a86e |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/decoder.onnx.data |
205.6 MB | 6904cf02d528 |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/f0_predictor.npz |
26.5 MB | 019d7d548514 |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/flow_encoder.onnx |
2.7 MB | db70cb6b9337 |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/flow_estimator.onnx |
334.7 MB | 0c6385594675 |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/flow_noise.npy |
4.8 MB | 1d0e8fbe9796 |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/hift.onnx |
329.4 MB | 539b2813b28c |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/lm_head.onnx |
6.1 MB | b2a2a452902c |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/mel80_24k.npy |
0.3 MB | 4f1aed49678e |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/pipeline.py |
15.9 kB | 4e50186a8f9a |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/speech_embed.onnx |
6.1 MB | ec4fa58e761a |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/speech_tokenizer_v3.onnx |
969.5 MB | 23236a74175d |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/text_embed.onnx |
136.7 MB | f4adfc639d51 |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/tokenizer.json |
10.6 MB | caa0dadcb8c4 |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
| int4 | int4/whisper_mel128.npy |
0.1 MB | 364239f8b565 |
LM 4-bit, DiT int8: WER 0.0 % / CER 0.0 %, similarity 0.971 / 0.957, DNSMOS 3.22 / 2.79; RTF 0.58 (CUDA) |
How to run
CosyVoice 3 (Fun-CosyVoice3-0.5B-2512: FunAudioLLM's speech generator, voice cloning from a few seconds of
reference audio and its transcript, Chinese, English and more, 24 kHz output) as ONNX graphs plus pipeline.py, a
numpy runtime that reproduces the official CosyVoice3.inference_zero_shot(..., text_frontend=False) around them.
Graphs from the publisher, in every folder as published (Apache-2.0, the original repository's files):
campplus.onnx (speaker embedding from 80-bin Kaldi fbank), speech_tokenizer_v3.onnx (speech tokens of the
prompt from a 128-bin Whisper log-mel). Converted here from the original PyTorch modules:
decoder.onnx: the Qwen2-0.5B speech-token LM (onnxruntime-genai's model builder):inputs_embeds,attention_mask,past_key_values.{0..23}.key / .value[1, 2, past, 64] ->hidden_states[1, S, 896] andpresent.*;lm_head.onnxturns the last hidden state into the 6761 speech-token logits.text_embed.onnx/speech_embed.onnx: the text and speech-token embeddings.flow_encoder.onnx: speech tokens [1, N] and the speaker embedding [1, 192] -> the flow's conditionmu[1, 80, 2N] and speaker vectorspks[1, 80].flow_estimator.onnx: the flow's 22-layer DiT, made from the publisher'sflow.decoder.estimator.fp32.onnx.x,mu,cond[2, 80, T],mask[2, 1, T],t[2],spks[2, 80] -> velocity [2, 80, T].hift.onnx: the HiFT vocoder with its neural source: mel [1, 80, T] and f0 [1, T] -> 24 kHz audio [1, 480 T]. Its STFT / inverse STFT are written as convolutions (ONNX has no inverse STFT), and its fixed noise is built in.
The f0 predictor runs in float64 in the original ("precision is crucial"), and ONNX Runtime has no float64
convolution: pipeline.py runs it in numpy, float64, from f0_predictor.npz. The flow's fixed starting noise is
flow_noise.npy. pipeline.py also does the frontend in numpy (Kaldi fbank, Whisper log-mel, the Matcha mel of the
prompt, and torchaudio's resampler, since another resampler changes the prompt mel noticeably), the LM loop with the
original's repetition-aware nucleus sampling (top-p 0.8, top-k 25, window 10), the silent-token filter, the flow's 10
Euler steps with classifier-free guidance 0.7, and the vocoder. It needs numpy, onnxruntime (or onnxruntime-gpu),
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, "fp16")
import pipeline
tts = pipeline.CosyVoice3("fp16", "cuda")
ref, sr = sf.read("voice.wav", dtype="float32")
wav, out_sr = tts("Text to say.", ref, sr, "Transcript of voice.wav.", seed=0) # 24 kHz
CosyVoice 3 needs <|endofprompt|> in its prompt text: the pipeline puts the official examples' "You are a helpful
assistant.<|endofprompt|>" in front of the transcript. The official text normalisation (wetext) is not included; pass
written-out text. Sampling uses numpy's generator, so a seed gives the same speech every run here, not the same speech
as PyTorch with that seed. On CUDA the LM's KV cache stays on the GPU, and its session is created with
enable_skip_layer_norm_strict_mode = 1; set it too if you run decoder.onnx yourself.
Precisions. fp16/: the LM in fp16; the embeddings, flow encoder and DiT estimator fp16 weights with fp32 math.
int8/: the LM 8-bit MatMulNBits (block 32), the DiT and the small graphs weight-only int8, embedding tables int8 per
row. int4/: the LM 4-bit MatMulNBits, the rest as int8/ (a 4-bit DiT put Chinese DNSMOS 0.24 below the original's). HiFT stays fp32 in every folder
(83 MB). No bf16 build.
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 the official code (inference_zero_shot, text_frontend=False) in fp32 on CUDA. 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, whole pipeline.
| English WER | similarity | DNSMOS | Chinese CER | similarity | DNSMOS | Real-time factor | |
|---|---|---|---|---|---|---|---|
| original (PyTorch fp32, CUDA) | 0.0 % | 0.973 | 3.22 | 0.3 % | 0.964 | 2.84 | 1.5 |
fp16/ (CUDA) |
0.0 % | 0.971 | 3.24 | 0.0 % | 0.959 | 2.80 | 0.53 |
int8/ (CUDA) |
0.3 % | 0.969 | 3.21 | 0.0 % | 0.955 | 2.77 | 0.56 |
int4/ (CUDA) |
0.0 % | 0.971 | 3.22 | 0.0 % | 0.957 | 2.79 | 0.58 |
Graphs checked against the original modules before the benchmark: HiFT 2.6e-5 from the generator's own inference, flow encoder 6e-6, embeddings and head 1e-6; the numpy frontend matches the original's features (speech tokens identical, speaker embedding 1e-5).
How these were made
From CosyVoice 3 at revision 29e01c4e8d. 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
Apache-2.0. 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
👉🏻 CosyVoice 👈🏻
Fun-CosyVoice 3.0: Demos; Paper; Modelscope; Huggingface; CV3-Eval
CosyVoice 2.0: Demos; Paper; Modelscope; HuggingFace
CosyVoice 1.0: Demos; Paper; Modelscope; HuggingFace
Highlight🔥
Fun-CosyVoice 3.0 is an advanced text-to-speech (TTS) system based on large language models (LLM), surpassing its predecessor (CosyVoice 2.0) in content consistency, speaker similarity, and prosody naturalness. It is designed for zero-shot multilingual speech synthesis in the wild.
Key Features
- Language Coverage: Covers 9 common languages (Chinese, English, Japanese, Korean, German, Spanish, French, Italian, Russian), 18+ Chinese dialects/accents (Guangdong, Minnan, Sichuan, Dongbei, Shan3xi, Shan1xi, Shanghai, Tianjin, Shandong, Ningxia, Gansu, etc.) and meanwhile supports both multi-lingual/cross-lingual zero-shot voice cloning.
- Content Consistency & Naturalness: Achieves state-of-the-art performance in content consistency, speaker similarity, and prosody naturalness.
- Pronunciation Inpainting: Supports pronunciation inpainting of Chinese Pinyin and English CMU phonemes, providing more controllability and thus suitable for production use.
- Text Normalization: Supports reading of numbers, special symbols and various text formats without a traditional frontend module.
- Bi-Streaming: Support both text-in streaming and audio-out streaming, and achieves latency as low as 150ms while maintaining high-quality audio output.
- Instruct Support: Supports various instructions such as languages, dialects, emotions, speed, volume, etc.
Roadmap
2025/12
- release Fun-CosyVoice3-0.5B-2512 base model, rl model and its training/inference script
- release Fun-CosyVoice3-0.5B modelscope gradio space
2025/08
- Thanks to the contribution from NVIDIA Yuekai Zhang, add triton trtllm runtime support and cosyvoice2 grpo training support
2025/07
- release Fun-CosyVoice 3.0 eval set
2025/05
- add CosyVoice2-0.5B vllm support
2024/12
- 25hz CosyVoice2-0.5B released
2024/09
- 25hz CosyVoice-300M base model
- 25hz CosyVoice-300M voice conversion function
2024/08
- Repetition Aware Sampling(RAS) inference for llm stability
- Streaming inference mode support, including kv cache and sdpa for rtf optimization
2024/07
- Flow matching training support
- WeTextProcessing support when ttsfrd is not available
- Fastapi server and client
Evaluation
| Model | Open-Source | Model Size | test-zh CER (%) ↓ |
test-zh Speaker Similarity (%) ↑ |
test-en WER (%) ↓ |
test-en Speaker Similarity (%) ↑ |
test-hard CER (%) ↓ |
test-hard Speaker Similarity (%) ↑ |
|---|---|---|---|---|---|---|---|---|
| Human | - | - | 1.26 | 75.5 | 2.14 | 73.4 | - | - |
| Seed-TTS | ❌ | - | 1.12 | 79.6 | 2.25 | 76.2 | 7.59 | 77.6 |
| MiniMax-Speech | ❌ | - | 0.83 | 78.3 | 1.65 | 69.2 | - | - |
| F5-TTS | ✅ | 0.3B | 1.52 | 74.1 | 2.00 | 64.7 | 8.67 | 71.3 |
| Spark TTS | ✅ | 0.5B | 1.2 | 66.0 | 1.98 | 57.3 | - | - |
| CosyVoice2 | ✅ | 0.5B | 1.45 | 75.7 | 2.57 | 65.9 | 6.83 | 72.4 |
| FireRedTTS2 | ✅ | 1.5B | 1.14 | 73.2 | 1.95 | 66.5 | - | - |
| Index-TTS2 | ✅ | 1.5B | 1.03 | 76.5 | 2.23 | 70.6 | 7.12 | 75.5 |
| VibeVoice-1.5B | ✅ | 1.5B | 1.16 | 74.4 | 3.04 | 68.9 | - | - |
| VibeVoice-Realtime | ✅ | 0.5B | - | - | 2.05 | 63.3 | - | - |
| HiggsAudio-v2 | ✅ | 3B | 1.50 | 74.0 | 2.44 | 67.7 | - | - |
| VoxCPM | ✅ | 0.5B | 0.93 | 77.2 | 1.85 | 72.9 | 8.87 | 73.0 |
| GLM-TTS | ✅ | 1.5B | 1.03 | 76.1 | - | - | - | - |
| GLM-TTS RL | ✅ | 1.5B | 0.89 | 76.4 | - | - | - | - |
| Fun-CosyVoice3-0.5B-2512 | ✅ | 0.5B | 1.21 | 78.0 | 2.24 | 71.8 | 6.71 | 75.8 |
| Fun-CosyVoice3-0.5B-2512_RL | ✅ | 0.5B | 0.81 | 77.4 | 1.68 | 69.5 | 5.44 | 75.0 |
Install
Clone and install
Clone the repo
git clone --recursive https://github.com/FunAudioLLM/CosyVoice.git # If you failed to clone the submodule due to network failures, please run the following command until success cd CosyVoice git submodule update --init --recursiveInstall Conda: please see https://docs.conda.io/en/latest/miniconda.html
Create Conda env:
conda create -n cosyvoice -y python=3.10 conda activate cosyvoice pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com # If you encounter sox compatibility issues # ubuntu sudo apt-get install sox libsox-dev # centos sudo yum install sox sox-devel
Model download
from huggingface_hub import snapshot_download
snapshot_download('FunAudioLLM/Fun-CosyVoice3-0.5B-2512', local_dir='pretrained_models/Fun-CosyVoice3-0.5B')
snapshot_download('FunAudioLLM/CosyVoice-ttsfrd', local_dir='pretrained_models/CosyVoice-ttsfrd')
Optionally, you can unzip ttsfrd resource and install ttsfrd package for better text normalization performance.
Notice that this step is not necessary. If you do not install ttsfrd package, we will use wetext by default.
cd pretrained_models/CosyVoice-ttsfrd/
unzip resource.zip -d .
pip install ttsfrd_dependency-0.1-py3-none-any.whl
pip install ttsfrd-0.4.2-cp310-cp310-linux_x86_64.whl
Basic Usage
import sys
sys.path.append('third_party/Matcha-TTS')
from cosyvoice.cli.cosyvoice import AutoModel
import torchaudio
""" CosyVoice3 Usage, check https://funaudiollm.github.io/cosyvoice3/ for more details
"""
cosyvoice = AutoModel(model_dir='pretrained_models/Fun-CosyVoice3-0.5B')
# en zero_shot usage
for i, j in enumerate(cosyvoice.inference_zero_shot('CosyVoice is undergoing a comprehensive upgrade, providing more accurate, stable, faster, and better voice generation capabilities.', 'You are a helpful assistant.<|endofprompt|>希望你以后能够做的比我还好呦。',
'./asset/zero_shot_prompt.wav', stream=False)):
torchaudio.save('zero_shot_{}.wav'.format(i), j['tts_speech'], cosyvoice.sample_rate)
# zh zero_shot usage
for i, j in enumerate(cosyvoice.inference_zero_shot('八百标兵奔北坡,北坡炮兵并排跑,炮兵怕把标兵碰,标兵怕碰炮兵炮。', 'You are a helpful assistant.<|endofprompt|>希望你以后能够做的比我还好呦。',
'./asset/zero_shot_prompt.wav', stream=False)):
torchaudio.save('zero_shot_{}.wav'.format(i), j['tts_speech'], cosyvoice.sample_rate)
# fine grained control, for supported control, check cosyvoice/tokenizer/tokenizer.py#L280
for i, j in enumerate(cosyvoice.inference_cross_lingual('You are a helpful assistant.<|endofprompt|>[breath]因为他们那一辈人[breath]在乡里面住的要习惯一点,[breath]邻居都很活络,[breath]嗯,都很熟悉。[breath]',
'./asset/zero_shot_prompt.wav', stream=False)):
torchaudio.save('fine_grained_control_{}.wav'.format(i), j['tts_speech'], cosyvoice.sample_rate)
# instruct usage, for supported control, check cosyvoice/utils/common.py#L28
for i, j in enumerate(cosyvoice.inference_instruct2('好少咯,一般系放嗰啲国庆啊,中秋嗰啲可能会咯。', 'You are a helpful assistant. 请用广东话表达。<|endofprompt|>',
'./asset/zero_shot_prompt.wav', stream=False)):
torchaudio.save('instruct_{}.wav'.format(i), j['tts_speech'], cosyvoice.sample_rate)
for i, j in enumerate(cosyvoice.inference_instruct2('收到好友从远方寄来的生日礼物,那份意外的惊喜与深深的祝福让我心中充满了甜蜜的快乐,笑容如花儿般绽放。', 'You are a helpful assistant. 请用尽可能快地语速说一句话。<|endofprompt|>',
'./asset/zero_shot_prompt.wav', stream=False)):
torchaudio.save('instruct_{}.wav'.format(i), j['tts_speech'], cosyvoice.sample_rate)
# hotfix usage
for i, j in enumerate(cosyvoice.inference_zero_shot('高管也通过电话、短信、微信等方式对报道[j][ǐ]予好评。', 'You are a helpful assistant.<|endofprompt|>希望你以后能够做的比我还好呦。',
'./asset/zero_shot_prompt.wav', stream=False)):
torchaudio.save('hotfix_{}.wav'.format(i), j['tts_speech'], cosyvoice.sample_rate)
Discussion & Communication
You can directly discuss on Github Issues.
You can also scan the QR code to join our official Dingding chat group.
Acknowledge
- We borrowed a lot of code from FunASR.
- We borrowed a lot of code from FunCodec.
- We borrowed a lot of code from Matcha-TTS.
- We borrowed a lot of code from AcademiCodec.
- We borrowed a lot of code from WeNet.
Citations
@article{du2024cosyvoice,
title={Cosyvoice: A scalable multilingual zero-shot text-to-speech synthesizer based on supervised semantic tokens},
author={Du, Zhihao and Chen, Qian and Zhang, Shiliang and Hu, Kai and Lu, Heng and Yang, Yexin and Hu, Hangrui and Zheng, Siqi and Gu, Yue and Ma, Ziyang and others},
journal={arXiv preprint arXiv:2407.05407},
year={2024}
}
@article{du2024cosyvoice,
title={Cosyvoice 2: Scalable streaming speech synthesis with large language models},
author={Du, Zhihao and Wang, Yuxuan and Chen, Qian and Shi, Xian and Lv, Xiang and Zhao, Tianyu and Gao, Zhifu and Yang, Yexin and Gao, Changfeng and Wang, Hui and others},
journal={arXiv preprint arXiv:2412.10117},
year={2024}
}
@article{du2025cosyvoice,
title={CosyVoice 3: Towards In-the-wild Speech Generation via Scaling-up and Post-training},
author={Du, Zhihao and Gao, Changfeng and Wang, Yuxuan and Yu, Fan and Zhao, Tianyu and Wang, Hao and Lv, Xiang and Wang, Hui and Shi, Xian and An, Keyu and others},
journal={arXiv preprint arXiv:2505.17589},
year={2025}
}
@inproceedings{lyu2025build,
title={Build LLM-Based Zero-Shot Streaming TTS System with Cosyvoice},
author={Lyu, Xiang and Wang, Yuxuan and Zhao, Tianyu and Wang, Hao and Liu, Huadai and Du, Zhihao},
booktitle={ICASSP 2025-2025 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
pages={1--2},
year={2025},
organization={IEEE}
}
Disclaimer
The content provided above is for academic purposes only and is intended to demonstrate technical capabilities. Some examples are sourced from the internet. If any content infringes on your rights, please contact us to request its removal.
Model tree for moonbox-dev/Fun-CosyVoice3-0.5B-2512-ONNX
Base model
FunAudioLLM/Fun-CosyVoice3-0.5B-2512