CosyVoice2Options

Options & Configuration · AiDotNet.TextToSpeech.CodecBased

Options for CosyVoice 2.

Inheritance: ModelOptions → CosyVoiceFamilyOptions → CosyVoiceConformerOptions → CosyVoiceAutoregressiveOptions → CosyVoice2Options

For Beginners

These options configure the CosyVoice 2 model. Default values follow the released model.

How It Works

The defaults are CosyVoice2-0.5B’s (FunAudioLLM/CosyVoice examples/libritts/cosyvoice2/conf/cosyvoice2.yaml): Qwen2.5-0.5B as the language model (24 layers, 896 wide, 14 query and 2 key-value heads, 4,864 units, RoPE θ 10⁶, RMSNorm ε 10⁻⁶; a 151,936-row token table read through Qwen’s tokenizer with CosyVoice 2’s added tokens) speaking the 25 Hz S3Tokenizer v2’s 6,561 tokens; the causal flow (an upsampling Conformer, 512 wide, 6 + 4 blocks, chunks of 25 tokens; a causal U-Net estimator, channels 256, 4 blocks, 12 mid blocks) giving two 80-band mel frames per token; HiFT at 24 kHz (upsampling 8·5·3, iSTFT 16/4); a 192-wide CAM++ x-vector.

Constructors

Constructor Summary
CosyVoice2Options() Initializes a new instance with default values.
CosyVoice2Options(CosyVoice2Options other) Initializes a new instance by copying all CosyVoice 2 settings.

Properties

Property Summary
double RmsEpsilon { get; set; } Qwen2’s RMSNorm epsilon.
double RopeTheta { get; set; } Qwen2’s rotary base (rope_theta).
int CodebookSize { get; set; } The released S3Tokenizer v2 cardinality: eight ternary FSQ dimensions give 3^8 = 6,561 codes.
int KeyValueHeads { get; set; } Qwen2’s key-value heads (grouped-query attention).
int LmFeedForwardDim { get; set; } Qwen2’s feed-forward width (intermediate_size).
int Lookahead { get; set; } Tokens the flow encoder’s look-ahead convolution reads ahead (pre_lookahead_len).
int SpeechTokenizerHeads { get; set; } S3 v2’s head count; each head has the released 64-wide rotary table.
int SpeechTokenizerState { get; set; } S3 v2’s state width; it must be 64 times its head count.
int StaticChunkSize { get; set; } The flow encoder’s streaming chunk in tokens (chunk_size; the estimator’s is this times TokenMelRatio).
int TokenMelRatio { get; set; } Mel frames per speech token (token_mel_ratio).