pub struct ModelManifest {
pub name: String,
pub task: String,
pub description: Option<String>,
pub license: String,
pub hf_repo: Option<String>,
pub files: Vec<ModelFile>,
}Expand description
A model manifest (models/*.toml).
Fields§
§name: String§task: StringTask tag: “asr”, “tts”, “ocr”, “vlm”.
description: Option<String>§license: StringThe WEIGHTS’ license — surfaced to users because it may be more
restrictive than FFai’s MIT/Apache code license.
hf_repo: Option<String>Hugging Face repo id, e.g. “openai/whisper-tiny”.
files: Vec<ModelFile>Implementations§
Source§impl ModelManifest
impl ModelManifest
pub fn from_toml(text: &str) -> Result<Self>
pub fn load(path: &Path) -> Result<Self>
Sourcepub fn cache_path(&self) -> PathBuf
pub fn cache_path(&self) -> PathBuf
Directory this model’s files live in when placed manually.
Sourcepub fn is_cached(&self) -> bool
pub fn is_cached(&self) -> bool
True when every listed file already resolves locally — no network.
Sourcepub fn local_path(&self, name: &str) -> Option<PathBuf>
pub fn local_path(&self, name: &str) -> Option<PathBuf>
Resolve one file without touching the network: a manual placement
under Self::cache_path wins, otherwise the shared Hugging Face
cache (the same one transformers/faster-whisper use, so a model
downloaded by either side is not downloaded twice).
Sourcepub fn fetch(&self) -> Result<ResolvedModel>
pub fn fetch(&self) -> Result<ResolvedModel>
Resolve every file, downloading from the Hugging Face hub as needed.
Downloads are cached, so this is cheap on repeat calls — but it is still network I/O the first time, which is why benchmarks warm the cache outside any timed region (see docs/benchmarking.md).
Sourcepub fn fetch_only(&self, needed: &[&str]) -> Result<ResolvedModel>
pub fn fetch_only(&self, needed: &[&str]) -> Result<ResolvedModel>
Self::fetch, for just the named files — the cache-and-download twin
of Self::resolve_only_in.
A manifest can list files no engine loads (ppocrv5-mobile-det lists
its training checkpoint, the source of the fused weights), and a hosted
repo need not carry them. Fetching every declared file made the first
download of the document engine fail on a file it never opens. A name
the manifest does not declare is an error: it has no checksum.
Sourcepub fn resolve_in(&self, root: &Path) -> Result<ResolvedModel>
pub fn resolve_in(&self, root: &Path) -> Result<ResolvedModel>
Resolve every file from root/<model name>/<file> and nowhere else —
no cache lookup, no network, ever.
This is the production form for a scheduled or offline job: the caller
states where weights live, a missing file is an error naming the exact
path that was expected, and nothing is fetched mid-job
(docs/plans/commercial-gaps.md, gap 7). Checksums are verified exactly
as Self::fetch verifies them.
Sourcepub fn resolve_only_in(
&self,
root: &Path,
needed: &[&str],
) -> Result<ResolvedModel>
pub fn resolve_only_in( &self, root: &Path, needed: &[&str], ) -> Result<ResolvedModel>
Self::resolve_in, for just the named files.
A manifest documents provenance as well as runtime needs, so it can list
files no engine loads. ppocrv5-mobile-det, for example, lists its
training checkpoint, the source of the fused weights. An offline
deployment must not be made to ship those, so a loader asks for what it
will open. A name the manifest does not declare is an error, because it
has no checksum to verify against.
Sourcepub fn verify(&self) -> Result<ResolvedModel>
pub fn verify(&self) -> Result<ResolvedModel>
Check that every file is already present locally and matches its
checksum, without downloading anything — the verify half of
prefetch/verify. Resolves exactly where Self::fetch would look.
Trait Implementations§
Source§impl Clone for ModelManifest
impl Clone for ModelManifest
Source§impl Debug for ModelManifest
impl Debug for ModelManifest
Source§impl<'de> Deserialize<'de> for ModelManifest
impl<'de> Deserialize<'de> for ModelManifest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ModelManifest
impl RefUnwindSafe for ModelManifest
impl Send for ModelManifest
impl Sync for ModelManifest
impl Unpin for ModelManifest
impl UnsafeUnpin for ModelManifest
impl UnwindSafe for ModelManifest
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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> ⓘ
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