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§
Sourcefn 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_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
Sourcefn 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 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
Sourcefn validate_config(
&self,
config: &ModelConfig,
) -> Result<Vec<ValidationIssue>, FerrumError>
fn validate_config( &self, config: &ModelConfig, ) -> Result<Vec<ValidationIssue>, FerrumError>
Validate model configuration
Sourcefn supported_model_types(&self) -> Vec<ModelType>
fn supported_model_types(&self) -> Vec<ModelType>
Get supported model types
Sourcefn 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 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
Sourcefn builder_info(&self) -> BuilderInfo
fn builder_info(&self) -> BuilderInfo
Get builder information