Skip to main content

WeightLoader

Trait WeightLoader 

Source
pub trait WeightLoader: Send + Sync {
    // Required methods
    fn load_tensor<'life0, 'life1, 'async_trait>(
        &'life0 self,
        spec: &'life1 TensorSpec,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn TensorLike>, FerrumError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn load_tensors<'life0, 'life1, 'async_trait>(
        &'life0 self,
        specs: &'life1 [TensorSpec],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<dyn TensorLike>>, FerrumError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn is_available<'life0, 'life1, 'async_trait>(
        &'life0 self,
        source: &'life1 WeightSource,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn get_metadata<'life0, 'life1, 'async_trait>(
        &'life0 self,
        source: &'life1 WeightSource,
    ) -> Pin<Box<dyn Future<Output = Result<WeightMetadata, FerrumError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn preload<'life0, 'life1, 'async_trait>(
        &'life0 self,
        source: &'life1 WeightSource,
    ) -> Pin<Box<dyn Future<Output = Result<(), FerrumError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn capabilities(&self) -> WeightLoaderCapabilities;
}
Expand description

Weight loading interface for model parameter management

Required Methods§

Source

fn load_tensor<'life0, 'life1, 'async_trait>( &'life0 self, spec: &'life1 TensorSpec, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn TensorLike>, FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Load tensor from weight specification

Source

fn load_tensors<'life0, 'life1, 'async_trait>( &'life0 self, specs: &'life1 [TensorSpec], ) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<dyn TensorLike>>, FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Load multiple tensors at once (batch loading)

Source

fn is_available<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 WeightSource, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Check if weight source is available

Source

fn get_metadata<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 WeightSource, ) -> Pin<Box<dyn Future<Output = Result<WeightMetadata, FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get metadata about weight source

Source

fn preload<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 WeightSource, ) -> Pin<Box<dyn Future<Output = Result<(), FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Preload weights into cache/memory

Source

fn capabilities(&self) -> WeightLoaderCapabilities

Get loader capabilities

Implementors§