pub struct ModelSpec {Show 14 fields
pub arch: String,
pub d: usize,
pub vocab: usize,
pub ctx_len: usize,
pub rms_eps: f64,
pub embedding_scale: Option<f64>,
pub tied_output: bool,
pub final_logit_softcap: Option<f64>,
pub layers: Vec<Layer>,
pub mtp_blocks: usize,
pub ffn_norm: &'static str,
pub hyper: Option<HyperConnections>,
pub ple: Option<Ple>,
pub indexer: Option<Indexer>,
}Expand description
What a checkpoint computes.
Fields§
§arch: Stringgeneral.architecture.
d: usizeHidden width.
vocab: usizeVocabulary size (rows of the token embedding).
ctx_len: usizeThe trained context window.
rms_eps: f64The RMSNorm epsilon every norm of the model uses.
embedding_scale: Option<f64>A scale applied to the token embedding as it is read (Gemma: √d).
tied_output: boolThe output projection is the token embedding (no output.weight in the file).
final_logit_softcap: Option<f64>Soft-capping of the final logits (cap · tanh(x / cap)).
layers: Vec<Layer>§mtp_blocks: usizeDraft blocks for multi-token prediction appended after the model’s layers.
ffn_norm: &'static strThe tensor stem of the norm on each block’s FFN input: ffn_norm, or post_attention_norm in Qwen3.5,
whose converter names the pre-FFN norm after the attention it follows.
hyper: Option<HyperConnections>The residual stream’s hyper-connections, in place of every norm (Qwen3.8-Flash-Next); None for one residual.
ple: Option<Ple>The hashed n-gram embedding one layer’s input takes (Qwen3.8-Flash-Next’s per-layer embedding).
indexer: Option<Indexer>The sparse selection of the positions every attention layer’s queries attend (Qwen’s QSA).
Implementations§
Source§impl ModelSpec
impl ModelSpec
Sourcepub fn from_gguf(g: &Gguf) -> Result<ModelSpec, SpecError>
pub fn from_gguf(g: &Gguf) -> Result<ModelSpec, SpecError>
Read the architecture of a GGUF checkpoint.
Sourcepub fn from_source<S: SpecSource + ?Sized>(
g: &S,
) -> Result<ModelSpec, SpecError>
pub fn from_source<S: SpecSource + ?Sized>( g: &S, ) -> Result<ModelSpec, SpecError>
Read the architecture of a checkpoint from anything that describes it (SpecSource).
Sourcepub fn attention_layers(&self) -> Vec<usize>
pub fn attention_layers(&self) -> Vec<usize>
The indices of the attention layers.
Trait Implementations§
impl StructuralPartialEq for ModelSpec
Auto Trait Implementations§
impl Freeze for ModelSpec
impl RefUnwindSafe for ModelSpec
impl Send for ModelSpec
impl Sync for ModelSpec
impl Unpin for ModelSpec
impl UnsafeUnpin for ModelSpec
impl UnwindSafe for ModelSpec
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.