Skip to main content

ModelFactory

Trait ModelFactory 

Source
pub trait ModelFactory: Send + Sync {
    // Required methods
    fn create_model(
        &self,
        config_json: &str,
    ) -> Result<Box<dyn Model<Config = Box<dyn ModelConfig>>>>;
    fn supported_architectures(&self) -> Vec<&str>;
    fn supports(&self, architecture: &str) -> bool;
}
Expand description

Model factory trait for creating models by name

Required Methods§

Source

fn create_model( &self, config_json: &str, ) -> Result<Box<dyn Model<Config = Box<dyn ModelConfig>>>>

Create model from configuration

Source

fn supported_architectures(&self) -> Vec<&str>

Get supported architecture names

Source

fn supports(&self, architecture: &str) -> bool

Check if architecture is supported

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§