pub struct BlockDef {
pub name: String,
pub attention: AttentionDef,
pub ssm: Option<SsmDef>,
pub ffn: FfnDef,
pub norm: NormConfig,
pub norm_position: NormPosition,
pub residual: bool,
pub dropout: f64,
}Expand description
Transformer block definition
The mixer is attention by default; when ssm is set the block is a
Mamba block (attention settings are ignored).
Fields§
§name: String§attention: AttentionDef§ssm: Option<SsmDef>§ffn: FfnDef§norm: NormConfig§norm_position: NormPosition§residual: bool§dropout: f64Implementations§
Source§impl BlockDef
impl BlockDef
pub fn is_ssm(&self) -> bool
pub fn num_heads(&self) -> usize
pub fn num_kv_heads(&self) -> usize
pub fn head_dim(&self, hidden_size: usize) -> usize
pub fn intermediate_size(&self, hidden_size: usize) -> usize
pub fn norm_eps(&self) -> f64
pub fn rope_theta(&self) -> f64
pub fn rope_scaling(&self) -> Option<f64>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for BlockDef
impl<'de> Deserialize<'de> for BlockDef
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 BlockDef
impl RefUnwindSafe for BlockDef
impl Send for BlockDef
impl Sync for BlockDef
impl Unpin for BlockDef
impl UnsafeUnpin for BlockDef
impl UnwindSafe for BlockDef
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