pub struct ModelDefinition {Show 15 fields
pub architecture: Architecture,
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: Option<usize>,
pub max_position_embeddings: usize,
pub rope_theta: Option<f64>,
pub rope_scaling: Option<RopeScaling>,
pub norm_type: NormType,
pub norm_eps: f64,
pub attention_config: AttentionConfig,
pub activation: Activation,
pub extra_params: Value,
}Expand description
Model definition from config.json
Fields§
§architecture: ArchitectureArchitecture type
Hidden size (embedding dimension)
intermediate_size: usizeIntermediate size (FFN dimension)
vocab_size: usizeVocabulary size
Number of hidden layers
num_attention_heads: usizeNumber of attention heads
num_key_value_heads: Option<usize>Number of key-value heads (for GQA)
max_position_embeddings: usizeMaximum position embeddings
rope_theta: Option<f64>RoPE theta (frequency base)
rope_scaling: Option<RopeScaling>RoPE scaling config
norm_type: NormTypeNormalization type
norm_eps: f64Normalization epsilon
attention_config: AttentionConfigAttention configuration
activation: ActivationActivation function
extra_params: ValueExtra parameters
Implementations§
Source§impl ModelDefinition
impl ModelDefinition
Sourcepub fn to_model_info(&self, model_id: impl Into<String>) -> ModelInfo
pub fn to_model_info(&self, model_id: impl Into<String>) -> ModelInfo
Convert to ModelInfo
Trait Implementations§
Source§impl Clone for ModelDefinition
impl Clone for ModelDefinition
Source§fn clone(&self) -> ModelDefinition
fn clone(&self) -> ModelDefinition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelDefinition
impl Debug for ModelDefinition
Source§impl Default for ModelDefinition
impl Default for ModelDefinition
Source§impl<'de> Deserialize<'de> for ModelDefinition
impl<'de> Deserialize<'de> for ModelDefinition
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
Auto Trait Implementations§
impl Freeze for ModelDefinition
impl RefUnwindSafe for ModelDefinition
impl Send for ModelDefinition
impl Sync for ModelDefinition
impl Unpin for ModelDefinition
impl UnsafeUnpin for ModelDefinition
impl UnwindSafe for ModelDefinition
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