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<TensorRef>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load_tensors<'life0, 'life1, 'async_trait>(
&'life0 self,
specs: &'life1 [TensorSpec],
) -> Pin<Box<dyn Future<Output = Result<Vec<TensorRef>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn is_available<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 WeightSource,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 WeightSource,
) -> Pin<Box<dyn Future<Output = Result<WeightMetadata>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn preload<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 WeightSource,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn capabilities(&self) -> WeightLoaderCapabilities;
}Expand description
Weight loading interface for model parameter management
Required Methods§
Sourcefn load_tensor<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 TensorSpec,
) -> Pin<Box<dyn Future<Output = Result<TensorRef>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_tensor<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 TensorSpec,
) -> Pin<Box<dyn Future<Output = Result<TensorRef>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load tensor from weight specification
Sourcefn load_tensors<'life0, 'life1, 'async_trait>(
&'life0 self,
specs: &'life1 [TensorSpec],
) -> Pin<Box<dyn Future<Output = Result<Vec<TensorRef>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_tensors<'life0, 'life1, 'async_trait>(
&'life0 self,
specs: &'life1 [TensorSpec],
) -> Pin<Box<dyn Future<Output = Result<Vec<TensorRef>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load multiple tensors at once (batch loading)
Sourcefn is_available<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 WeightSource,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_available<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 WeightSource,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if weight source is available
Sourcefn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 WeightSource,
) -> Pin<Box<dyn Future<Output = Result<WeightMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 WeightSource,
) -> Pin<Box<dyn Future<Output = Result<WeightMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get metadata about weight source
Sourcefn preload<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 WeightSource,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn preload<'life0, 'life1, 'async_trait>(
&'life0 self,
source: &'life1 WeightSource,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Preload weights into cache/memory
Sourcefn capabilities(&self) -> WeightLoaderCapabilities
fn capabilities(&self) -> WeightLoaderCapabilities
Get loader capabilities