Skip to main content

ModelMetadata

Struct ModelMetadata 

Source
pub struct ModelMetadata {
Show 19 fields pub architecture: String, 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 vocab_size: usize, pub max_position_embeddings: usize, pub rms_norm_eps: f64, pub rope_theta: f64, pub tie_word_embeddings: bool, pub head_dim: usize, pub attention_bias: bool, pub bos_token_id: Option<u32>, pub eos_token_ids: Vec<u32>, pub vision: Option<VisionConfig>, pub attention_pattern: AttentionPattern, pub activation: Activation, pub rope_scaling: RopeScaling,
}
Expand description

Architecture + hyperparameter description of a model, format-agnostic.

Field names follow the HuggingFace Llama config convention; other architecture families remap their config onto this struct in their adapter.

Fields§

§architecture: String

Architecture identifier, e.g. "llama", "smollm2" (from config.json::model_type). The model registry keys on this string.

§hidden_size: usize

Hidden size (model dimension).

§intermediate_size: usize

MLP intermediate size.

§num_hidden_layers: usize

Number of transformer layers.

§num_attention_heads: usize

Number of attention query heads.

§num_key_value_heads: usize

Number of key/value heads (GQA). Equal to num_attention_heads for MHA.

§vocab_size: usize

Vocabulary size.

§max_position_embeddings: usize

Maximum positional embeddings the model was built for.

§rms_norm_eps: f64

RMSNorm epsilon.

§rope_theta: f64

RoPE base frequency (theta).

§tie_word_embeddings: bool

Whether lm_head is tied to the embedding matrix.

§head_dim: usize

Per-head dimension, derived: hidden_size / num_attention_heads.

§attention_bias: bool

Whether attention projections carry biases.

§bos_token_id: Option<u32>

Beginning-of-sequence token id, if defined.

§eos_token_ids: Vec<u32>

End-of-sequence token ids (merged from config + generation_config).

§vision: Option<VisionConfig>

Vision-tower hyperparameters for multimodal models (Idefics3/SmolVLM today); None for text-only models.

§attention_pattern: AttentionPattern

Layer-type attention pattern (Gemma sliding-window interleave); defaults to all-global (Llama-family behavior).

§activation: Activation

MLP activation (hidden_act / hidden_activation).

§rope_scaling: RopeScaling

RoPE frequency scaling (rope_scaling); None variant when absent.

Implementations§

Source§

impl ModelMetadata

Source

pub fn diffusion_placeholder(architecture: &str) -> Self

Minimal placeholder metadata for diffusion components that do not carry a language-model config.json (UNet, VAE, etc.).

Source

pub fn from_hf_config( config: &Value, generation_config: Option<&Value>, ) -> Result<Self>

Parses metadata from a HuggingFace config.json value, optionally merged with a generation_config.json value (which can override/add bos/eos ids).

Trait Implementations§

Source§

impl Clone for ModelMetadata

Source§

fn clone(&self) -> ModelMetadata

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModelMetadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<C> CloneExpand for C
where C: Clone,

Source§

fn __expand_clone_method(&self, _scope: &mut Scope) -> C

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoComptime for T

Source§

fn comptime(self) -> Self

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more