pub struct ModelSource { /* private fields */ }Expand description
Source for loading a model from disk or HuggingFace.
Implementations§
Source§impl ModelSource
impl ModelSource
Sourcepub fn from_file(path: impl Into<PathBuf>) -> Self
pub fn from_file(path: impl Into<PathBuf>) -> Self
Create a source backed by a local model file.
Sourcepub fn from_hf(repo_id: impl Into<String>, filename: impl Into<String>) -> Self
pub fn from_hf(repo_id: impl Into<String>, filename: impl Into<String>) -> Self
Create a source backed by a HuggingFace repo + filename.
Sourcepub fn from_hf_dir(
repo_id: impl Into<String>,
directory: impl Into<String>,
) -> Self
pub fn from_hf_dir( repo_id: impl Into<String>, directory: impl Into<String>, ) -> Self
Create a source backed by a HuggingFace repo + directory prefix.
Sourcepub fn with_revision(self, revision: impl Into<String>) -> Self
pub fn with_revision(self, revision: impl Into<String>) -> Self
Set the HuggingFace revision (branch, tag, or commit SHA).
Sourcepub fn resolve(&self) -> Result<PathBuf, ModelSourceError>
pub fn resolve(&self) -> Result<PathBuf, ModelSourceError>
Resolve the model path, downloading if necessary.
Sourcepub fn local_path(&self) -> Option<&Path>
pub fn local_path(&self) -> Option<&Path>
Return the local path when the source is a file.
Trait Implementations§
Source§impl Clone for ModelSource
impl Clone for ModelSource
Source§fn clone(&self) -> ModelSource
fn clone(&self) -> ModelSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModelSource
impl Debug for ModelSource
Source§impl PartialEq for ModelSource
impl PartialEq for ModelSource
impl Eq for ModelSource
impl StructuralPartialEq for ModelSource
Auto Trait Implementations§
impl Freeze for ModelSource
impl RefUnwindSafe for ModelSource
impl Send for ModelSource
impl Sync for ModelSource
impl Unpin for ModelSource
impl UnsafeUnpin for ModelSource
impl UnwindSafe for ModelSource
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