pub struct Mamba3CacheConfig {
pub batch: usize,
pub state_rank: usize,
pub per_head_dim: usize,
pub nheads: usize,
pub mimo_rank: usize,
pub num_rope_angles: usize,
}Expand description
Configuration / factory for a single Mamba3Cache.
Fields§
§batch: usizeBatch size.
state_rank: usizeState rank N.
per_head_dim: usizeHead dimension P.
nheads: usizeNumber of SSM heads H.
mimo_rank: usizeMIMO rank R. 1 = SISO.
num_rope_angles: usizeNumber of RoPE angle pairs = rope_dim / 2 = (state_rank * rope_fraction) / 2
(rounded down to even via Mamba3Config::rope_dim).
Implementations§
Source§impl Mamba3CacheConfig
impl Mamba3CacheConfig
Sourcepub fn new(batch: usize, nheads: usize, num_rope_angles: usize) -> Self
pub fn new(batch: usize, nheads: usize, num_rope_angles: usize) -> Self
Create a new instance of the config.
§Arguments
§Required Arguments
§batch
Batch size.
§nheads
Number of SSM heads H.
§num_rope_angles
Number of RoPE angle pairs = rope_dim / 2 = (state_rank * rope_fraction) / 2
(rounded down to even via Mamba3Config::rope_dim).
§Default Arguments
§state_rank
State rank N.
- Defaults to
128
§per_head_dim
Head dimension P.
- Defaults to
64
§mimo_rank
MIMO rank R. 1 = SISO.
- Defaults to
1
Source§impl Mamba3CacheConfig
impl Mamba3CacheConfig
Sourcepub fn with_state_rank(self, state_rank: usize) -> Self
pub fn with_state_rank(self, state_rank: usize) -> Self
Sourcepub fn with_per_head_dim(self, per_head_dim: usize) -> Self
pub fn with_per_head_dim(self, per_head_dim: usize) -> Self
Sourcepub fn with_mimo_rank(self, mimo_rank: usize) -> Self
pub fn with_mimo_rank(self, mimo_rank: usize) -> Self
Source§impl Mamba3CacheConfig
impl Mamba3CacheConfig
Sourcepub fn new_from_block_config(batch: usize, block_config: Mamba3Config) -> Self
pub fn new_from_block_config(batch: usize, block_config: Mamba3Config) -> Self
Derive cache shapes from a Mamba-3 block configuration plus a batch size.
Sourcepub fn init<B: Backend>(&self, device: &B::Device) -> Mamba3Cache<B>
pub fn init<B: Backend>(&self, device: &B::Device) -> Mamba3Cache<B>
Allocate zero-initialised cache tensors on device.
Trait Implementations§
Source§impl Clone for Mamba3CacheConfig
impl Clone for Mamba3CacheConfig
Source§impl Config for Mamba3CacheConfig
impl Config for Mamba3CacheConfig
§fn load_binary(data: &[u8]) -> Result<Self, ConfigError>
fn load_binary(data: &[u8]) -> Result<Self, ConfigError>
Loads the configuration from a binary buffer. Read more
Source§impl Debug for Mamba3CacheConfig
impl Debug for Mamba3CacheConfig
Source§impl<'de> Deserialize<'de> for Mamba3CacheConfig
impl<'de> Deserialize<'de> for Mamba3CacheConfig
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
Source§impl Display for Mamba3CacheConfig
impl Display for Mamba3CacheConfig
Auto Trait Implementations§
impl Freeze for Mamba3CacheConfig
impl RefUnwindSafe for Mamba3CacheConfig
impl Send for Mamba3CacheConfig
impl Sync for Mamba3CacheConfig
impl Unpin for Mamba3CacheConfig
impl UnsafeUnpin for Mamba3CacheConfig
impl UnwindSafe for Mamba3CacheConfig
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