pub struct HuggingFaceModel { /* private fields */ }Expand description
A synchronous Hugging Face model resolver.
Resolution is separate from crate::Engine::load. The resolver returns a
standalone GGUF path or a sparse, runtime-complete Safetensors snapshot
directory in the normal Hugging Face cache layout.
Implementations§
Source§impl HuggingFaceModel
impl HuggingFaceModel
Sourcepub fn gguf(repo_id: impl Into<String>, filename: impl Into<String>) -> Self
pub fn gguf(repo_id: impl Into<String>, filename: impl Into<String>) -> Self
Selects one standalone GGUF file from the repository’s main revision.
Sourcepub fn safetensors(repo_id: impl Into<String>) -> Self
pub fn safetensors(repo_id: impl Into<String>) -> Self
Selects a runtime-complete Safetensors directory from the repository’s main revision.
Sourcepub fn revision(self, revision: impl Into<String>) -> Self
pub fn revision(self, revision: impl Into<String>) -> Self
Overrides the repository revision with a branch, tag, or commit.
Sourcepub fn cache_dir(self, cache_dir: impl Into<PathBuf>) -> Self
pub fn cache_dir(self, cache_dir: impl Into<PathBuf>) -> Self
Overrides the Hugging Face Hub cache directory.
The path is the Hub cache itself (for example, ~/.cache/huggingface/hub),
not its parent.
Sourcepub fn token(self, token: impl Into<String>) -> Self
pub fn token(self, token: impl Into<String>) -> Self
Sets the Hugging Face token for this resolver.
An explicit token takes precedence over HF_TOKEN and the cached token.
Sourcepub fn progress(self, progress: bool) -> Self
pub fn progress(self, progress: bool) -> Self
Enables or disables download progress bars. Progress is disabled by default.
Sourcepub fn offline(self, offline: bool) -> Self
pub fn offline(self, offline: bool) -> Self
Enables or disables cache-only resolution. Offline mode never builds an API.
Sourcepub fn resolve(&self) -> Result<PathBuf, HuggingFaceError>
pub fn resolve(&self) -> Result<PathBuf, HuggingFaceError>
Resolves the selected model into the normal Hugging Face cache.
Trait Implementations§
Source§impl Clone for HuggingFaceModel
impl Clone for HuggingFaceModel
Source§fn clone(&self) -> HuggingFaceModel
fn clone(&self) -> HuggingFaceModel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more