pub struct ModelConfig {
pub vocab_size: usize,
pub embed_dim: usize,
pub hidden_dim: usize,
pub num_layers: usize,
pub num_heads: usize,
pub max_seq_len: usize,
pub quant_type: QuantizationType,
}Expand description
Model configuration
Fields§
§vocab_size: usizeVocabulary size
embed_dim: usizeEmbedding dimension
Hidden dimension in FFN
num_layers: usizeNumber of transformer layers
num_heads: usizeNumber of attention heads
max_seq_len: usizeMaximum sequence length
quant_type: QuantizationTypeQuantization type
Implementations§
Source§impl ModelConfig
impl ModelConfig
Sourcepub fn validate(&self, variant: Esp32Variant) -> Result<()>
pub fn validate(&self, variant: Esp32Variant) -> Result<()>
Validate configuration fits ESP32 constraints
Sourcepub fn estimate_size(&self) -> usize
pub fn estimate_size(&self) -> usize
Estimate total model size in bytes
Sourcepub fn for_variant(variant: Esp32Variant) -> Self
pub fn for_variant(variant: Esp32Variant) -> Self
Get recommended config for variant
Trait Implementations§
Source§impl Clone for ModelConfig
impl Clone for ModelConfig
Source§fn clone(&self) -> ModelConfig
fn clone(&self) -> ModelConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 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