Skip to main content

AdvancedModelBuilder

Trait AdvancedModelBuilder 

Source
pub trait AdvancedModelBuilder: ModelBuilder {
    // Required methods
    fn build_with_custom_layers<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 ModelConfig,
        custom_layers: Vec<Box<dyn CustomLayer>>,
        compute_backend: Arc<dyn ComputeBackend>,
        weight_loader: Arc<dyn WeightLoader>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn build_incremental<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 ModelConfig,
        compute_backend: Arc<dyn ComputeBackend>,
        weight_loader: Arc<dyn WeightLoader>,
        progress_callback: Box<dyn Fn(BuildProgress) + Send + Sync>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn build_with_optimization<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 ModelConfig,
        optimization_pipeline: Vec<Box<dyn OptimizationPass>>,
        compute_backend: Arc<dyn ComputeBackend>,
        weight_loader: Arc<dyn WeightLoader>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn export_model_definition<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 ModelConfig,
    ) -> Pin<Box<dyn Future<Output = Result<ModelIR>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn import_model_definition<'life0, 'life1, 'async_trait>(
        &'life0 self,
        definition: &'life1 ModelIR,
        compute_backend: Arc<dyn ComputeBackend>,
        weight_loader: Arc<dyn WeightLoader>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Advanced model builder with additional capabilities

Required Methods§

Source

fn build_with_custom_layers<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 ModelConfig, custom_layers: Vec<Box<dyn CustomLayer>>, compute_backend: Arc<dyn ComputeBackend>, weight_loader: Arc<dyn WeightLoader>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Build model with custom layers

Source

fn build_incremental<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 ModelConfig, compute_backend: Arc<dyn ComputeBackend>, weight_loader: Arc<dyn WeightLoader>, progress_callback: Box<dyn Fn(BuildProgress) + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Build model incrementally (for large models)

Source

fn build_with_optimization<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 ModelConfig, optimization_pipeline: Vec<Box<dyn OptimizationPass>>, compute_backend: Arc<dyn ComputeBackend>, weight_loader: Arc<dyn WeightLoader>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Build model with custom optimization pipeline

Source

fn export_model_definition<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 ModelConfig, ) -> Pin<Box<dyn Future<Output = Result<ModelIR>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Export model definition for debugging

Source

fn import_model_definition<'life0, 'life1, 'async_trait>( &'life0 self, definition: &'life1 ModelIR, compute_backend: Arc<dyn ComputeBackend>, weight_loader: Arc<dyn WeightLoader>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Import model definition for custom builds

Implementors§