pub struct CodePredictorConfig {
pub hidden_size: usize,
pub intermediate_size: usize,
pub num_hidden_layers: usize,
pub num_attention_heads: usize,
pub num_key_value_heads: usize,
pub head_dim: usize,
pub rms_norm_eps: f64,
pub rope_theta: f64,
pub vocab_size: usize,
pub num_code_groups: usize,
pub codec_embed_dim: Option<usize>,
}Expand description
Code predictor configuration
Fields§
Hidden dimension
intermediate_size: usizeIntermediate size for MLP
Number of transformer layers
num_attention_heads: usizeNumber of attention heads
num_key_value_heads: usizeNumber of KV heads (for GQA)
head_dim: usizeHead dimension
rms_norm_eps: f64RMS norm epsilon
rope_theta: f64RoPE theta
vocab_size: usizeVocabulary size for codec tokens
num_code_groups: usizeNumber of code groups (total, including semantic)
codec_embed_dim: Option<usize>Codec embedding dimension (may differ from hidden_size for CustomVoice models) When different from hidden_size, a small_to_mtp_projection is used
Implementations§
Source§impl CodePredictorConfig
impl CodePredictorConfig
Sourcepub fn from_parsed(parsed: &ParsedModelConfig) -> Self
pub fn from_parsed(parsed: &ParsedModelConfig) -> Self
Create config from parsed HuggingFace config.json.
When the talker hidden_size differs from the code predictor hidden_size
(e.g. 1.7B models: talker=2048, CP=1024), codec_embed_dim is set to
the talker’s hidden_size so the small_to_mtp_projection layer is created.
Sourcepub fn codec_embed_dim(&self) -> usize
pub fn codec_embed_dim(&self) -> usize
Get the codec embedding dimension (defaults to hidden_size)
Sourcepub fn custom_voice() -> Self
pub fn custom_voice() -> Self
Create config for CustomVoice model
Trait Implementations§
Source§impl Clone for CodePredictorConfig
impl Clone for CodePredictorConfig
Source§fn clone(&self) -> CodePredictorConfig
fn clone(&self) -> CodePredictorConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodePredictorConfig
impl Debug for CodePredictorConfig
Auto Trait Implementations§
impl Freeze for CodePredictorConfig
impl RefUnwindSafe for CodePredictorConfig
impl Send for CodePredictorConfig
impl Sync for CodePredictorConfig
impl Unpin for CodePredictorConfig
impl UnsafeUnpin for CodePredictorConfig
impl UnwindSafe for CodePredictorConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more