pub struct ModelRegistry { /* private fields */ }Expand description
Model registry for creating and managing model instances
Implementations§
Source§impl ModelRegistry
impl ModelRegistry
Sourcepub fn register(&mut self, name: impl Into<String>, config: ModelConfig)
pub fn register(&mut self, name: impl Into<String>, config: ModelConfig)
Register a model configuration with a name
Sourcepub fn get_config(&self, name: &str) -> Option<&ModelConfig>
pub fn get_config(&self, name: &str) -> Option<&ModelConfig>
Get a registered configuration
Sourcepub fn list_models(&self) -> Vec<String>
pub fn list_models(&self) -> Vec<String>
List all registered model names
Sourcepub fn create_model(
&self,
name: &str,
) -> InferenceResult<Box<dyn AutoregressiveModel>>
pub fn create_model( &self, name: &str, ) -> InferenceResult<Box<dyn AutoregressiveModel>>
Create a model wrapper from a configuration
Sourcepub fn load_weights(
&self,
_model: &mut dyn AutoregressiveModel,
path: impl AsRef<Path>,
) -> InferenceResult<()>
pub fn load_weights( &self, _model: &mut dyn AutoregressiveModel, path: impl AsRef<Path>, ) -> InferenceResult<()>
Load weights from a file
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelRegistry
impl RefUnwindSafe for ModelRegistry
impl Send for ModelRegistry
impl Sync for ModelRegistry
impl Unpin for ModelRegistry
impl UnwindSafe for ModelRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more