mstar.model.cosyvoice3.config#
Configuration for Fun-CosyVoice3 (FunAudioLLM/Fun-CosyVoice3-0.5B-2512).
The checkpoint ships a hyperpyyaml file (cosyvoice3.yaml) that builds the
reference classes directly; there is no config.json. The dataclasses below
write its values down once. Every shape they declare is checked against the
checkpoint when the weights load.
Sources (read, not copied): cosyvoice3.yaml from the HF snapshot and
cosyvoice/{llm/llm.py,flow/flow.py,flow/flow_matching.py,flow/DiT/*,
hifigan/generator.py,hifigan/f0_predictor.py,cli/model.py,cli/frontend.py}
from FunAudioLLM/CosyVoice.
The reference-audio front end is Chatterbox’s: the 25 Hz speech tokenizer v3 is
Chatterbox’s S3Tokenizer with twelve blocks instead of six, the speaker
encoder is the same CAMPPlus, and the prompt mel is the same 24 kHz Matcha mel
with fmax left at Nyquist. Their configs are Chatterbox’s dataclasses.
Classes
|
|
|
|
|
|
|
CausalMaskedDiffWithDiT: tokens -> |
|
CosyVoice3LM: a Qwen2 0.5B backbone ( |
|
Repetition-aware sampling ( |
- class mstar.model.cosyvoice3.config.CausalHiFTConfig(in_channels=80, base_channels=512, nb_harmonics=8, sampling_rate=24000, nsf_alpha=0.1, nsf_sigma=0.003, nsf_voiced_threshold=10.0, upsample_rates=(8, 5, 3), upsample_kernel_sizes=(16, 11, 7), istft_n_fft=16, istft_hop_len=4, resblock_kernel_sizes=(3, 7, 11), resblock_dilation_sizes=((1, 3, 5), (1, 3, 5), (1, 3, 5)), source_resblock_kernel_sizes=(7, 7, 11), source_resblock_dilation_sizes=((1, 3, 5), (1, 3, 5), (1, 3, 5)), lrelu_slope=0.1, audio_limit=0.99, f0_cond_channels=512, conv_pre_look_right=4, f0_look_right=3, noise_seed=1986, noise_seconds=300.0)[source]#
Bases:
S3GenHiFTConfigCausalHiFTGenerator: Chatterbox’s HiFT hyper-parameters, with causal convolutions, a causal F0 predictor (three frames of look-ahead), a pre-convolution that looks four frames ahead and fixed excitation noise.- Parameters:
in_channels (int)
base_channels (int)
nb_harmonics (int)
sampling_rate (int)
nsf_alpha (float)
nsf_sigma (float)
nsf_voiced_threshold (float)
istft_n_fft (int)
istft_hop_len (int)
source_resblock_dilation_sizes (tuple[tuple[int, ...], ...])
lrelu_slope (float)
audio_limit (float)
f0_cond_channels (int)
conv_pre_look_right (int)
f0_look_right (int)
noise_seed (int)
noise_seconds (float)
- class mstar.model.cosyvoice3.config.CosyVoice3Config(lm: 'LMConfig' = <factory>, sampling: 'SamplingDefaults' = <factory>, flow: 'FlowConfig' = <factory>, hift: 'CausalHiFTConfig' = <factory>, tokenizer: 'S3TokenizerConfig' = <factory>, xvector: 'S3GenXVectorConfig' = <factory>, mel: 'S3GenMelConfig' = <factory>, llm_weights: 'str' = 'llm.pt', flow_weights: 'str' = 'flow.pt', hift_weights: 'str' = 'hift.pt', speech_tokenizer_onnx: 'str' = 'speech_tokenizer_v3.onnx', campplus_onnx: 'str' = 'campplus.onnx', text_tokenizer_dir: 'str' = 'CosyVoice-BlankEN', silent_tokens: 'tuple[int, ...]'=(1, 2, 28, 29, 55, 248, 494, 2241, 2242, 2322, 2323), max_silent_tokens: 'int' = 5, max_text_tokens: 'int' = 512, max_reference_seconds: 'float' = 30.0, max_speech_tokens: 'int' = 2048, voice_cache_size: 'int' = 64, max_new_tokens_limit: 'int | None' = None, stream_hop_tokens: 'int' = 25, stream_hop_growth: 'float' = 2.0, stream_max_hop_tokens: 'int' = 100, stream_poll_tokens: 'int' = 25, hift_context_frames: 'int' = 64, flow_estimator_dtype: 'str' = 'bfloat16', flow_max_batch_size: 'int' = 8, hift_max_batch_size: 'int' = 8)[source]#
Bases:
object- Parameters:
lm (LMConfig)
sampling (SamplingDefaults)
flow (FlowConfig)
hift (CausalHiFTConfig)
tokenizer (S3TokenizerConfig)
xvector (S3GenXVectorConfig)
mel (S3GenMelConfig)
llm_weights (str)
flow_weights (str)
hift_weights (str)
speech_tokenizer_onnx (str)
campplus_onnx (str)
text_tokenizer_dir (str)
max_silent_tokens (int)
max_text_tokens (int)
max_reference_seconds (float)
max_speech_tokens (int)
voice_cache_size (int)
max_new_tokens_limit (int | None)
stream_hop_tokens (int)
stream_hop_growth (float)
stream_max_hop_tokens (int)
stream_poll_tokens (int)
hift_context_frames (int)
flow_estimator_dtype (str)
flow_max_batch_size (int)
hift_max_batch_size (int)
- flow: FlowConfig#
- hift: CausalHiFTConfig#
- mel: S3GenMelConfig#
- sampling: SamplingDefaults#
- tokenizer: S3TokenizerConfig#
- xvector: S3GenXVectorConfig#
- class mstar.model.cosyvoice3.config.DiTConfig(dim: 'int' = 1024, depth: 'int' = 22, heads: 'int' = 16, dim_head: 'int' = 64, ff_mult: 'int' = 2, mel_dim: 'int' = 80, mu_dim: 'int' = 80, spk_dim: 'int' = 80, conv_pos_kernel: 'int' = 31, conv_pos_groups: 'int' = 16, time_freq_dim: 'int' = 256, static_chunk_size: 'int' = 50)[source]#
Bases:
object- Parameters:
- class mstar.model.cosyvoice3.config.FlowConfig(vocab_size=6561, input_size=80, output_size=80, spk_embed_dim=192, token_mel_ratio=2, pre_lookahead_len=3, pre_lookahead_channels=1024, dit=<factory>, cfm=<factory>, noise_seed=0, noise_frames=15000)[source]#
Bases:
objectCausalMaskedDiffWithDiT: tokens ->
mu(embedding, look-ahead convs, x2 repeat) -> mel by a classifier-free-guided Euler solve of the DiT.- Parameters:
- cfm: S3GenCFMConfig#
- class mstar.model.cosyvoice3.config.LMConfig(hidden_size=896, num_hidden_layers=24, num_attention_heads=14, num_key_value_heads=2, head_dim=64, intermediate_size=4864, rms_norm_eps=1e-06, rope_theta=1000000.0, text_vocab_size=151936, speech_token_size=6561, num_control_tokens=200)[source]#
Bases:
objectCosyVoice3LM: a Qwen2 0.5B backbone (
CosyVoice-BlankEN) with its own speech-token embedding and head overspeech_token_size + 200ids.- Parameters:
- class mstar.model.cosyvoice3.config.SamplingDefaults(temperature=1.0, top_p=0.8, top_k=25, ras_window=10, ras_tau=0.1, min_token_text_ratio=2.0, max_token_text_ratio=20.0)[source]#
Bases:
objectRepetition-aware sampling (
cosyvoice.utils.common.ras_sampling): a nucleus draw (top-p over at most top-k ids); a draw that already appears>= ras_window * ras_tautimes in the lastras_windowtokens is masked and redrawn from the full distribution.- Parameters: