pub struct StaticEmbedder { /* private fields */ }Expand description
A loaded model2vec-format model. Cheap to share behind an Arc; embed takes &self.
Implementations§
Source§impl StaticEmbedder
impl StaticEmbedder
Sourcepub fn load(paths: &ModelPaths, manifest: &ArtefactManifest) -> Result<Self>
pub fn load(paths: &ModelPaths, manifest: &ArtefactManifest) -> Result<Self>
Loads and verifies a model from local files. Fails, never warns, when either file’s
blake3 digest differs from the manifest, when the files do not parse, when the
matrix is not [vocab, dim], contains a non-finite value, or has fewer rows than
the tokenizer has ids.
pub fn load_with( paths: &ModelPaths, manifest: &ArtefactManifest, opts: LoadOptions, ) -> Result<Self>
Sourcepub fn describe(
paths: &ModelPaths,
manifest: &ArtefactManifest,
) -> Result<Description>
pub fn describe( paths: &ModelPaths, manifest: &ArtefactManifest, ) -> Result<Description>
What a loaded model would report as its profile and dimension, without loading it.
For status, doctor and a scan with nothing to embed (2026-09-25: each of them
parsed the tokenizer and read the matrix for these two values, 2.6 s). Both files are
verified against the manifest exactly as load does, the weights through the same
staleness record; only the tokenizer is not parsed and the matrix not read beyond its
header. A tokenizer that does not parse is therefore found by the first recall, not
here.
Sourcepub fn embed_one(&self, text: &str) -> Result<Embedding>
pub fn embed_one(&self, text: &str) -> Result<Embedding>
Embeds one input. Errors only on a tokenizer failure, which no ordinary text causes.
Sourcepub fn embed_all(&self, texts: &[&str]) -> Result<Vec<Embedding>>
pub fn embed_all(&self, texts: &[&str]) -> Result<Vec<Embedding>>
Embeds a batch, in input order, splitting large batches across rayon’s pool.
pub fn vocab_rows(&self) -> usize
pub fn unk_id(&self) -> Option<u32>
pub fn manifest(&self) -> &ArtefactManifest
pub fn info(&self) -> ModelInfo
Trait Implementations§
Source§impl Debug for StaticEmbedder
impl Debug for StaticEmbedder
Source§impl Embedder for StaticEmbedder
impl Embedder for StaticEmbedder
Source§fn profile_id(&self) -> &str
fn profile_id(&self) -> &str
Auto Trait Implementations§
impl !Freeze for StaticEmbedder
impl RefUnwindSafe for StaticEmbedder
impl Send for StaticEmbedder
impl Sync for StaticEmbedder
impl Unpin for StaticEmbedder
impl UnsafeUnpin for StaticEmbedder
impl UnwindSafe for StaticEmbedder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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