pub struct Mamba1Caches {
pub caches: Vec<Mamba1Cache>,
}Expand description
A collection of per-layer caches for a complete Mamba-1 network.
During autoregressive decoding a Mamba1Caches instance is threaded
through every layer-stack step call (the family-generic
[crate::generic::Layers]). Each element corresponds to one (virtual) layer
in the network.
Fields§
§caches: Vec<Mamba1Cache>Per-layer caches.
Length: n_real_caches (the number of virtual layers, which may
exceed the number of real weight layers when weight-sharing / layer
scheduling is in use).
Implementations§
Source§impl Mamba1Caches
impl Mamba1Caches
Sourcepub fn caches_len(&self) -> usize
pub fn caches_len(&self) -> usize
Number of per-layer caches.
Sourcepub fn from_vec(vec: Vec<Mamba1Cache>) -> Self
pub fn from_vec(vec: Vec<Mamba1Cache>) -> Self
Wrap a vector of per-layer caches.
Sourcepub fn into_options(self) -> Vec<Option<Mamba1Cache>>
pub fn into_options(self) -> Vec<Option<Mamba1Cache>>
Wrap each per-layer cache in Some so the layer loop can take it
without cloning (Burn tensors are reference-counted).
Sourcepub fn from_options(options: Vec<Option<Mamba1Cache>>) -> Self
pub fn from_options(options: Vec<Option<Mamba1Cache>>) -> Self
Inverse of Self::into_options: unwrap each slot and re-bundle.
Trait Implementations§
Source§impl AutodiffModule for Mamba1Caches
impl AutodiffModule for Mamba1Caches
Source§impl CacheStack for Mamba1Caches
impl CacheStack for Mamba1Caches
Source§type Cache = Mamba1Cache
type Cache = Mamba1Cache
The per-layer cache element.
Source§fn slot_count(&self) -> usize
fn slot_count(&self) -> usize
Number of per-(virtual-)layer slots.
Source§fn into_slots(self) -> Vec<Option<Mamba1Cache>>
fn into_slots(self) -> Vec<Option<Mamba1Cache>>
Move each slot into an
Option so the loop can take without cloning.Source§fn from_slots(slots: Vec<Option<Mamba1Cache>>) -> Self
fn from_slots(slots: Vec<Option<Mamba1Cache>>) -> Self
Inverse of
Self::into_slots.Source§impl Clone for Mamba1Caches
impl Clone for Mamba1Caches
Source§impl Debug for Mamba1Caches
impl Debug for Mamba1Caches
Source§impl Display for Mamba1Caches
impl Display for Mamba1Caches
Source§impl Module for Mamba1Caches
impl Module for Mamba1Caches
Source§fn num_params(&self) -> usize
fn num_params(&self) -> usize
Get the number of parameters the module has, including all of its sub-modules.
Source§fn visit<Visitor: ModuleVisitor>(&self, visitor: &mut Visitor)
fn visit<Visitor: ModuleVisitor>(&self, visitor: &mut Visitor)
Visit each tensor parameter in the module with a visitor.
Source§fn map<Mapper: ModuleMapper>(self, mapper: &mut Mapper) -> Self
fn map<Mapper: ModuleMapper>(self, mapper: &mut Mapper) -> Self
Map each tensor parameter in the module with a mapper.
Source§fn collect_devices(&self, devices: Devices) -> Devices
fn collect_devices(&self, devices: Devices) -> Devices
Return all the devices found in the underneath module tree added to the given vector
without duplicates.
Source§fn to_device(self, device: &Device) -> Self
fn to_device(self, device: &Device) -> Self
Move the module and all of its sub-modules to the given device. Read more
Source§fn fork(self, device: &Device) -> Self
fn fork(self, device: &Device) -> Self
Fork the module and all of its sub-modules to the given device. Read more
§fn devices(&self) -> Vec<Device>
fn devices(&self) -> Vec<Device>
Return all the devices found in the underneath module tree without duplicates.
§fn train(self) -> Selfwhere
Self: AutodiffModule,
fn train(self) -> Selfwhere
Self: AutodiffModule,
Move the module and all of its sub-modules to the autodiff backend. Read more
§fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
Quantize the weights of the module.
§fn into_record(self) -> ModuleRecordwhere
Self: Sized,
fn into_record(self) -> ModuleRecordwhere
Self: Sized,
Collect this module’s parameters into a
ModuleRecord. Read more§fn try_load_record(self, record: ModuleRecord) -> Result<Self, RecordError>where
Self: Sized,
fn try_load_record(self, record: ModuleRecord) -> Result<Self, RecordError>where
Self: Sized,
Apply a
ModuleRecord to this module, returning the loaded
module. Read more§fn load_record(self, record: ModuleRecord) -> Selfwhere
Self: Sized,
fn load_record(self, record: ModuleRecord) -> Selfwhere
Self: Sized,
Apply a
ModuleRecord to this module, consuming and returning
it. Read moreSource§impl ModuleDisplay for Mamba1Caches
impl ModuleDisplay for Mamba1Caches
§fn format(&self, passed_settings: DisplaySettings) -> String
fn format(&self, passed_settings: DisplaySettings) -> String
Formats the module with provided display settings. Read more
§fn custom_settings(&self) -> Option<DisplaySettings>
fn custom_settings(&self) -> Option<DisplaySettings>
Custom display settings for the module. Read more
§fn custom_content(&self, _content: Content) -> Option<Content>
fn custom_content(&self, _content: Content) -> Option<Content>
Custom attributes for the module. Read more
Auto Trait Implementations§
impl Freeze for Mamba1Caches
impl RefUnwindSafe for Mamba1Caches
impl Send for Mamba1Caches
impl Sync for Mamba1Caches
impl Unpin for Mamba1Caches
impl UnsafeUnpin for Mamba1Caches
impl UnwindSafe for Mamba1Caches
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