pub struct ModelZoo { /* private fields */ }Expand description
File-based pretrained model registry.
Points to a local directory that stores {arch_name}.bin weight files
in the same format as save_weights / load_weights.
Implementations§
Source§impl ModelZoo
impl ModelZoo
Sourcepub fn new(registry_dir: impl Into<PathBuf>) -> Self
pub fn new(registry_dir: impl Into<PathBuf>) -> Self
Creates a new zoo pointing at registry_dir.
Sourcepub fn load_pretrained(
&self,
arch: ModelArchitecture,
graph: &mut Graph,
) -> Result<SequentialModel, ModelError>
pub fn load_pretrained( &self, arch: ModelArchitecture, graph: &mut Graph, ) -> Result<SequentialModel, ModelError>
Builds the architecture and loads pretrained weights from
{registry_dir}/{arch_name}.bin.
Sourcepub fn list_available(&self) -> Vec<ModelArchitecture>
pub fn list_available(&self) -> Vec<ModelArchitecture>
Lists architectures for which a .bin weight file exists in the registry.
Sourcepub fn save_pretrained(
&self,
arch: ModelArchitecture,
model: &SequentialModel,
graph: &Graph,
) -> Result<(), ModelError>
pub fn save_pretrained( &self, arch: ModelArchitecture, model: &SequentialModel, graph: &Graph, ) -> Result<(), ModelError>
Saves a model’s layer weights to {registry_dir}/{arch_name}.bin.
Auto Trait Implementations§
impl Freeze for ModelZoo
impl RefUnwindSafe for ModelZoo
impl Send for ModelZoo
impl Sync for ModelZoo
impl Unpin for ModelZoo
impl UnsafeUnpin for ModelZoo
impl UnwindSafe for ModelZoo
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> 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