pub struct ModelZooLoader { /* private fields */ }Expand description
Loads pretrained (or synthetic-seed) models from the ModelZoo registry.
§Example
use oxirs_embed::model_zoo::{ModelZoo, ModelZooLoader};
let loader = ModelZooLoader::new(std::env::temp_dir()).accept_license();
// Would load a real checkpoint when source resolves to a real file:
// let model = loader.load("transe-fb15k237")?;Implementations§
Source§impl ModelZooLoader
impl ModelZooLoader
Sourcepub fn new(base_dir: impl Into<PathBuf>) -> Self
pub fn new(base_dir: impl Into<PathBuf>) -> Self
Create a loader that stores materialised checkpoints under base_dir.
Sourcepub fn with_zoo(zoo: &'static ModelZoo, base_dir: impl Into<PathBuf>) -> Self
pub fn with_zoo(zoo: &'static ModelZoo, base_dir: impl Into<PathBuf>) -> Self
Create a loader backed by a custom (non-global) ModelZoo.
Sourcepub fn accept_license(self) -> Self
pub fn accept_license(self) -> Self
Signal that the caller accepts all licenses (including restrictive ones
such as CC-BY-NC-4.0).
Sourcepub fn load(&self, name: &str) -> Result<Box<dyn EmbeddingModel>, ModelZooError>
pub fn load(&self, name: &str) -> Result<Box<dyn EmbeddingModel>, ModelZooError>
Load the model identified by name from the registry.
Returns a heap-allocated, type-erased EmbeddingModel.
Auto Trait Implementations§
impl Freeze for ModelZooLoader
impl RefUnwindSafe for ModelZooLoader
impl Send for ModelZooLoader
impl Sync for ModelZooLoader
impl Unpin for ModelZooLoader
impl UnsafeUnpin for ModelZooLoader
impl UnwindSafe for ModelZooLoader
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.