pub struct ModelConfig {
pub architectures: Vec<String>,
pub hidden_size: usize,
pub num_attention_heads: usize,
pub num_key_value_heads: Option<usize>,
pub num_hidden_layers: usize,
pub intermediate_size: usize,
pub vocab_size: usize,
pub max_position_embeddings: usize,
pub rms_norm_eps: f32,
pub rope_theta: f32,
pub tie_word_embeddings: bool,
pub model_type: String,
}Expand description
Model configuration from config.json
Fields§
§architectures: Vec<String>Model architecture type
Hidden size / embedding dimension
num_attention_heads: usizeNumber of attention heads
num_key_value_heads: Option<usize>Number of key-value heads (for GQA)
Number of transformer layers
intermediate_size: usizeIntermediate size (MLP)
vocab_size: usizeVocabulary size
max_position_embeddings: usizeMaximum context length
rms_norm_eps: f32RMS norm epsilon
rope_theta: f32RoPE theta
tie_word_embeddings: boolTie word embeddings
model_type: StringModel type string
Implementations§
Source§impl ModelConfig
impl ModelConfig
Sourcepub fn from_model_dir(model_dir: &Path) -> HubResult<Self>
pub fn from_model_dir(model_dir: &Path) -> HubResult<Self>
Load config from a model directory.
Trait Implementations§
Source§impl Clone for ModelConfig
impl Clone for ModelConfig
Source§impl Debug for ModelConfig
impl Debug for ModelConfig
Source§impl Default for ModelConfig
impl Default 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
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