pub struct ModelConfig {Show 13 fields
pub vocab_size: usize,
pub n_layer: usize,
pub d_model: usize,
pub n_head: usize,
pub d_inner: usize,
pub ctx_len: usize,
pub dropout: f32,
pub rope_base: f64,
pub tie_embeddings: bool,
pub position_type: PositionType,
pub qk_norm: bool,
pub norm_style: NormStyle,
pub block_schedule: Option<Vec<usize>>,
}Expand description
Transformer architectural configuration.
Fields§
§vocab_size: usizeVocabulary token count.
n_layer: usizeNumber of physical transformer blocks.
d_model: usizeResidual stream width.
n_head: usizeNumber of attention heads.
d_inner: usizeSwiGLU hidden width.
ctx_len: usizeMaximum context window length.
dropout: f32Dropout probability used only during prefix replay.
rope_base: f64Rotary embedding frequency base (10000.0).
tie_embeddings: boolWhether input and output embeddings share weights (false in v2).
position_type: PositionTypePositional encoding strategy.
qk_norm: boolPer-head QK RMSNorm toggle (true in v2).
norm_style: NormStyleResidual normalization placement (Peri in v2).
block_schedule: Option<Vec<usize>>Optional recurrent block execution order over 0..n_layer.
Implementations§
Source§impl ModelConfig
impl ModelConfig
Sourcepub fn tiny(vocab_size: usize) -> Self
pub fn tiny(vocab_size: usize) -> Self
Returns a fast, tiny Transformer preset suited for smoke tests and small files.
Sourcepub fn validate(&self) -> Result<(), CodecError>
pub fn validate(&self) -> Result<(), CodecError>
Validates architectural invariants.
§Errors
Returns CodecError::InvalidConfig if dimensions or schedules are invalid.
Trait Implementations§
Source§impl Clone for ModelConfig
impl Clone for ModelConfig
Source§impl Debug for ModelConfig
impl Debug for ModelConfig
Source§impl<'de> Deserialize<'de> for ModelConfig
impl<'de> Deserialize<'de> for ModelConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ModelConfig
impl PartialEq for ModelConfig
Source§impl Serialize for ModelConfig
impl Serialize for ModelConfig
impl StructuralPartialEq for ModelConfig
Auto Trait Implementations§
impl Freeze for ModelConfig
impl RefUnwindSafe for ModelConfig
impl Send for ModelConfig
impl Sync for ModelConfig
impl Unpin for ModelConfig
impl UnsafeUnpin for ModelConfig
impl UnwindSafe for ModelConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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