pub struct ModelRegistry<B: Backend> { /* private fields */ }Expand description
Maps architecture identifiers (config.json::model_type, plus known
aliases) to loaders. Mirrors MLC’s model.py::MODELS table.
Implementations§
Source§impl<B: Backend> ModelRegistry<B>
impl<B: Backend> ModelRegistry<B>
Sourcepub fn register(
&mut self,
architecture: &str,
loader: fn(&dyn ModelSource, &Device<B>) -> Result<Box<dyn GenerativeModel<B>>>,
)
pub fn register( &mut self, architecture: &str, loader: fn(&dyn ModelSource, &Device<B>) -> Result<Box<dyn GenerativeModel<B>>>, )
Registers (or replaces) the loader for an architecture id.
Sourcepub fn architectures(&self) -> Vec<&str>
pub fn architectures(&self) -> Vec<&str>
Registered architecture ids.
Sourcepub fn load(
&self,
source: &dyn ModelSource,
device: &Device<B>,
) -> Result<Box<dyn GenerativeModel<B>>>
pub fn load( &self, source: &dyn ModelSource, device: &Device<B>, ) -> Result<Box<dyn GenerativeModel<B>>>
Loads the model described by source’s metadata.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for ModelRegistry<B>
impl<B> RefUnwindSafe for ModelRegistry<B>
impl<B> Send for ModelRegistry<B>
impl<B> Sync for ModelRegistry<B>
impl<B> Unpin for ModelRegistry<B>
impl<B> UnsafeUnpin for ModelRegistry<B>
impl<B> UnwindSafe for ModelRegistry<B>
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