Skip to main content

ModelBuilder

Trait ModelBuilder 

Source
pub trait ModelBuilder: Send + Sync {
    // Required methods
    fn build_model<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 ModelConfig,
        compute_backend: Arc<dyn ComputeBackend>,
        weight_loader: Arc<dyn WeightLoader>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>, FerrumError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn build_from_source<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        source: &'life1 ModelSource,
        compute_backend: Arc<dyn ComputeBackend>,
        weight_loader: Arc<dyn WeightLoader>,
        build_options: &'life2 BuildOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>, FerrumError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn validate_config(
        &self,
        config: &ModelConfig,
    ) -> Result<Vec<ValidationIssue>, FerrumError>;
    fn supported_model_types(&self) -> Vec<ModelType>;
    fn estimate_build_time<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 ModelConfig,
    ) -> Pin<Box<dyn Future<Output = Result<BuildTimeEstimate, FerrumError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn builder_info(&self) -> BuilderInfo;
}
Expand description

Model builder for constructing model executors

Required Methods§

Source

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

Build model executor from configuration

Source

fn build_from_source<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 ModelSource, compute_backend: Arc<dyn ComputeBackend>, weight_loader: Arc<dyn WeightLoader>, build_options: &'life2 BuildOptions, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ModelExecutor>, FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Build model executor from model source

Source

fn validate_config( &self, config: &ModelConfig, ) -> Result<Vec<ValidationIssue>, FerrumError>

Validate model configuration

Source

fn supported_model_types(&self) -> Vec<ModelType>

Get supported model types

Source

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

Get estimated build time

Source

fn builder_info(&self) -> BuilderInfo

Get builder information

Implementors§