pub struct Config {Show 19 fields
pub hidden_size: usize,
pub intermediate_size: usize,
pub vocab_size: usize,
pub num_hidden_layers: usize,
pub num_attention_heads: usize,
pub num_key_value_heads: usize,
pub rms_norm_eps: f64,
pub rope_theta: f32,
pub bos_token_id: Option<u32>,
pub eos_token_id: Option<EosTokenId>,
pub rope_scaling: Option<RopeScaling>,
pub tie_word_embeddings: bool,
pub max_seq_len: usize,
pub use_qkv_bias: bool,
pub model_prefix: String,
pub head_dim: Option<usize>,
pub partial_rotary_factor: f32,
pub linear_attn: Option<LinearAttnConfig>,
pub residual_rms_norm: bool,
}Expand description
Generalized LLM configuration shared by all decoder-only text models.
Fields§
§intermediate_size: usize§vocab_size: usize§num_attention_heads: usize§num_key_value_heads: usize§rms_norm_eps: f64§rope_theta: f32§bos_token_id: Option<u32>§eos_token_id: Option<EosTokenId>§rope_scaling: Option<RopeScaling>§tie_word_embeddings: bool§max_seq_len: usize§use_qkv_bias: boolWhether Q/K/V projections use bias (true for Qwen2, false for LLaMA).
model_prefix: StringWeight tensor prefix for the transformer stack (e.g. “model” or “model.language_model”).
head_dim: Option<usize>Explicit head dimension when it differs from hidden_size / num_attention_heads.
partial_rotary_factor: f32Fraction of head dims to apply rotary embeddings to (1.0 = all, 0.25 = first quarter).
linear_attn: Option<LinearAttnConfig>Linear attention configuration (None for pure softmax-attention models).
residual_rms_norm: boolWhether RMS norm uses residual weight: (1 + weight) * norm(x) instead of weight * norm(x).
True for Qwen3.5 whose norm weights are initialized to zero with +1 applied at runtime.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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