mstar.model.chatterbox.config#
Configuration for Chatterbox and Chatterbox-Turbo.
Resemble publishes no config.json for either checkpoint: every hyper
parameter lives in the reference package’s Python sources (T3Config,
LLAMA_CONFIGS, the S3Gen constructor arguments) and, for Turbo, in a
stale training yaml. The dataclasses below are that specification, written
down once, with the two shipped variants as constructors. Every shape they
declare is checked against the checkpoint when the weights are loaded.
Sources (read, not copied): chatterbox/models/t3/modules/t3_config.py,
chatterbox/models/t3/llama_configs.py, chatterbox/tts.py,
chatterbox/tts_turbo.py, chatterbox/models/s3gen/s3gen.py,
chatterbox/models/voice_encoder/config.py,
chatterbox/models/s3tokenizer/s3tokenizer.py.
Classes
|
|
|
|
|
|
|
S3 speech tokens -> mel (flow matching) -> waveform (HiFT). |
|
UpsampleConformerEncoder: 6 blocks at 25 Hz, x2 upsample, 4 blocks at 50 Hz. |
|
ConditionalDecoder: causal 1-D UNet with transformer blocks. |
|
|
|
|
|
CAMPPlus speaker encoder (80-bin Kaldi fbank, 16 kHz). |
|
S3TokenizerV2 (25 Hz): Whisper-style log-mel front end, FSMN attention encoder, finite-scalar quantizer. |
|
The causal transformer behind T3. |
|
|
|
- class mstar.model.chatterbox.config.ChatterboxConfig(variant: 'str' = 'chatterbox', t3: 'T3Config' = <factory>, voice_encoder: 'VoiceEncoderConfig' = <factory>, s3_tokenizer: 'S3TokenizerConfig' = <factory>, s3gen: 'S3GenConfig' = <factory>, generation: 'GenerationDefaults' = <factory>, t3_weights: 'str' = 't3_cfg.safetensors', s3gen_weights: 'str' = 's3gen.safetensors', voice_encoder_weights: 'str' = 've.safetensors', text_tokenizer_file: 'str' = 'tokenizer.json', builtin_voice_file: 'str' = 'conds.pt', cangjie_file: 'str' = '', default_language: 'str | None' = None, enc_cond_seconds: 'float' = 6.0, dec_cond_seconds: 'float' = 10.0, normalize_reference_loudness: 'bool' = False, reference_target_lufs: 'float' = -27.0, trailing_silence_tokens: 'int' = 0, max_text_tokens: 'int' = 512, voice_cache_size: 'int' = 64, max_new_tokens_limit: 'int | None' = None, stream_first_chunk_tokens: 'int' = 15, stream_chunk_tokens: 'int' = 50, stream_chunk_growth: 'float' = 2.0, stream_max_chunk_tokens: 'int' = 200, stream_mel_cache_frames: 'int' = 8, stream_context_tokens: 'int' = 25, s3gen_compile: 'bool' = False, s3gen_compile_mode: 'str' = 'default', s3gen_frame_bucket: 'int' = 64, s3gen_graphs: 'bool' = True, s3gen_graph_stages: 'str' = 'solve, encoder, vocoder', s3gen_estimator_dtype: 'str' = 'float16', t3_prefill_graphs: 'bool' = True, s3gen_max_batch_size: 'int' = 8)[source]#
Bases:
object- Parameters:
variant (str)
t3 (T3Config)
voice_encoder (VoiceEncoderConfig)
s3_tokenizer (S3TokenizerConfig)
s3gen (S3GenConfig)
generation (GenerationDefaults)
t3_weights (str)
s3gen_weights (str)
voice_encoder_weights (str)
text_tokenizer_file (str)
builtin_voice_file (str)
cangjie_file (str)
default_language (str | None)
enc_cond_seconds (float)
dec_cond_seconds (float)
normalize_reference_loudness (bool)
reference_target_lufs (float)
trailing_silence_tokens (int)
max_text_tokens (int)
voice_cache_size (int)
max_new_tokens_limit (int | None)
stream_first_chunk_tokens (int)
stream_chunk_tokens (int)
stream_chunk_growth (float)
stream_max_chunk_tokens (int)
stream_mel_cache_frames (int)
stream_context_tokens (int)
s3gen_compile (bool)
s3gen_compile_mode (str)
s3gen_frame_bucket (int)
s3gen_graphs (bool)
s3gen_graph_stages (str)
s3gen_estimator_dtype (str)
t3_prefill_graphs (bool)
s3gen_max_batch_size (int)
- classmethod from_model_path(model_path_hf)[source]#
Pick the variant from the repo id (
ResembleAI/chatterbox-turbo).- Parameters:
model_path_hf (str)
- Return type:
- generation: GenerationDefaults#
- classmethod multilingual()[source]#
Chatterbox Multilingual (reference
mtl_tts.py): the same S3Gen, voice encoder, built-in voice and sampling as the English model; the T3 weightst3_mtl23ls_v2.safetensorsand the grapheme tokenizer with a language token.- Return type:
- s3_tokenizer: S3TokenizerConfig#
- s3gen: S3GenConfig#
- voice_encoder: VoiceEncoderConfig#
- class mstar.model.chatterbox.config.GenerationDefaults(temperature: 'float' = 0.8, top_p: 'float' = 1.0, top_k: 'int' = 0, min_p: 'float' = 0.05, repetition_penalty: 'float' = 1.2, cfg_weight: 'float' = 0.5, exaggeration: 'float' = 0.5, max_new_tokens: 'int' = 1000, n_cfm_timesteps: 'int' = 10, watermark: 'bool' = True)[source]#
Bases:
object- Parameters:
- class mstar.model.chatterbox.config.S3GenCFMConfig(sigma_min: 'float' = 1e-06, t_scheduler: 'str' = 'cosine', inference_cfg_rate: 'float' = 0.7, n_timesteps: 'int' = 10)[source]#
Bases:
object
- class mstar.model.chatterbox.config.S3GenConfig(sample_rate=24000, vocab_size=6561, token_mel_ratio=2, output_size=80, spk_embed_dim=192, mel=<factory>, encoder=<factory>, estimator=<factory>, cfm=<factory>, hift=<factory>, xvector=<factory>, meanflow=False, trim_fade_frames=480)[source]#
Bases:
objectS3 speech tokens -> mel (flow matching) -> waveform (HiFT).
- Parameters:
sample_rate (int)
vocab_size (int)
token_mel_ratio (int)
output_size (int)
spk_embed_dim (int)
mel (S3GenMelConfig)
encoder (S3GenEncoderConfig)
estimator (S3GenEstimatorConfig)
cfm (S3GenCFMConfig)
hift (S3GenHiFTConfig)
xvector (S3GenXVectorConfig)
meanflow (bool)
trim_fade_frames (int)
- cfm: S3GenCFMConfig#
- encoder: S3GenEncoderConfig#
- estimator: S3GenEstimatorConfig#
- hift: S3GenHiFTConfig#
- mel: S3GenMelConfig#
- xvector: S3GenXVectorConfig#
- class mstar.model.chatterbox.config.S3GenEncoderConfig(input_size=512, output_size=512, attention_heads=8, linear_units=2048, num_blocks=6, num_up_blocks=4, pre_lookahead_len=3, up_stride=2, layer_norm_eps=1e-12)[source]#
Bases:
objectUpsampleConformerEncoder: 6 blocks at 25 Hz, x2 upsample, 4 blocks at 50 Hz.
- Parameters:
- class mstar.model.chatterbox.config.S3GenEstimatorConfig(in_channels=320, out_channels=80, channels=(256,), attention_head_dim=64, n_blocks=4, num_mid_blocks=12, num_heads=8, causal=True)[source]#
Bases:
objectConditionalDecoder: causal 1-D UNet with transformer blocks.
- Parameters:
- class mstar.model.chatterbox.config.S3GenHiFTConfig(in_channels: 'int' = 80, base_channels: 'int' = 512, nb_harmonics: 'int' = 8, sampling_rate: 'int' = 24000, nsf_alpha: 'float' = 0.1, nsf_sigma: 'float' = 0.003, nsf_voiced_threshold: 'float' = 10.0, upsample_rates: 'tuple[int, ...]' = (8, 5, 3), upsample_kernel_sizes: 'tuple[int, ...]' = (16, 11, 7), istft_n_fft: 'int' = 16, istft_hop_len: 'int' = 4, resblock_kernel_sizes: 'tuple[int, ...]' = (3, 7, 11), resblock_dilation_sizes: 'tuple[tuple[int, ...], ...]' = ((1, 3, 5), (1, 3, 5), (1, 3, 5)), source_resblock_kernel_sizes: 'tuple[int, ...]' = (7, 7, 11), source_resblock_dilation_sizes: 'tuple[tuple[int, ...], ...]' = ((1, 3, 5), (1, 3, 5), (1, 3, 5)), lrelu_slope: 'float' = 0.1, audio_limit: 'float' = 0.99, f0_cond_channels: 'int' = 512)[source]#
Bases:
object- 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)
- class mstar.model.chatterbox.config.S3GenMelConfig(n_fft: 'int' = 1920, num_mels: 'int' = 80, sample_rate: 'int' = 24000, hop_size: 'int' = 480, win_size: 'int' = 1920, fmin: 'float' = 0.0, fmax: 'float' = 8000.0)[source]#
Bases:
object- Parameters:
- class mstar.model.chatterbox.config.S3GenXVectorConfig(feat_dim=80, embedding_size=192, growth_rate=32, bn_size=4, init_channels=128, block_num_layers=(12, 24, 16), block_kernel_sizes=(3, 3, 3), block_dilations=(1, 2, 2))[source]#
Bases:
objectCAMPPlus speaker encoder (80-bin Kaldi fbank, 16 kHz).
- Parameters:
- class mstar.model.chatterbox.config.S3TokenizerConfig(n_mels=128, n_fft=400, hop_size=160, sample_rate=16000, n_state=1280, n_head=20, n_layer=6, fsmn_kernel_size=31, fsq_levels=3, fsq_dim=8, token_rate=25, max_frames_per_pass=3000)[source]#
Bases:
objectS3TokenizerV2 (25 Hz): Whisper-style log-mel front end, FSMN attention encoder, finite-scalar quantizer.
- Parameters:
- class mstar.model.chatterbox.config.T3BackboneConfig(kind='llama', hidden_size=1024, num_hidden_layers=30, num_attention_heads=16, num_key_value_heads=16, head_dim=64, intermediate_size=4096, norm_eps=1e-05, max_position_embeddings=131072, rope_theta=500000.0, rope_scaling=<factory>)[source]#
Bases:
objectThe causal transformer behind T3.
kindselects the block:"llama"(RMSNorm, SwiGLU, RoPE through the position resource) for Chatterbox,"gpt2"(LayerNorm, GELU-tanh MLP, learned absolute positions looked up on the planned position ids) for Turbo.- Parameters:
- class mstar.model.chatterbox.config.T3Config(backbone: 'T3BackboneConfig' = <factory>, text_vocab_size: 'int' = 704, speech_vocab_size: 'int' = 8194, start_text_token: 'int' = 255, stop_text_token: 'int' = 0, start_speech_token: 'int' = 6561, stop_speech_token: 'int' = 6562, max_text_tokens: 'int' = 2048, max_speech_tokens: 'int' = 4096, learned_pos_emb: 'bool' = True, speaker_embed_size: 'int' = 256, speech_cond_prompt_len: 'int' = 150, use_perceiver_resampler: 'bool' = True, perceiver_num_queries: 'int' = 32, perceiver_num_heads: 'int' = 4, emotion_adv: 'bool' = True, speech_head_bias: 'bool' = False, duplicate_bos_in_prefill: 'bool' = True)[source]#
Bases:
object- Parameters:
backbone (T3BackboneConfig)
text_vocab_size (int)
speech_vocab_size (int)
start_text_token (int)
stop_text_token (int)
start_speech_token (int)
stop_speech_token (int)
max_text_tokens (int)
max_speech_tokens (int)
learned_pos_emb (bool)
speaker_embed_size (int)
speech_cond_prompt_len (int)
use_perceiver_resampler (bool)
perceiver_num_queries (int)
perceiver_num_heads (int)
emotion_adv (bool)
speech_head_bias (bool)
duplicate_bos_in_prefill (bool)
- backbone: T3BackboneConfig#
- property cond_len: int#
speaker, prompt (resampled or raw), emotion.
- Type:
Conditioning tokens in front of the text
- class mstar.model.chatterbox.config.VoiceEncoderConfig(num_mels: 'int' = 40, sample_rate: 'int' = 16000, hidden_size: 'int' = 256, num_layers: 'int' = 3, speaker_embed_size: 'int' = 256, n_fft: 'int' = 400, hop_size: 'int' = 160, win_size: 'int' = 400, fmin: 'float' = 0.0, fmax: 'float' = 8000.0, mel_power: 'float' = 2.0, partial_frames: 'int' = 160, partials_rate: 'float' = 1.3, min_coverage: 'float' = 0.8, final_relu: 'bool' = True)[source]#
Bases:
object- Parameters: