pub struct FerrotensorHub { /* private fields */ }Expand description
Main entry point for loading models from HuggingFace Hub.
Currently supports loading from local directories.
Download models using huggingface-cli download or the Python huggingface_hub library.
§Example
let hub = FerrotensorHub::new();
let config = hub.load_config("meta-llama/Llama-3.2-1B")?;
println!("Model has {} layers", config.num_hidden_layers);Implementations§
Source§impl FerrotensorHub
impl FerrotensorHub
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new FerrotensorHub instance with default cache directory.
Default cache: ~/.cache/huggingface/hub/models--{org}--{model}
Sourcepub fn with_cache_dir(cache_dir: PathBuf) -> Self
pub fn with_cache_dir(cache_dir: PathBuf) -> Self
Create a FerrotensorHub with a custom cache directory.
Sourcepub fn get_model_path(&self, model_id: &str) -> PathBuf
pub fn get_model_path(&self, model_id: &str) -> PathBuf
Get the path to a cached model.
Compatible with HuggingFace cache format.
Sourcepub fn find_latest_snapshot(&self, model_id: &str) -> HubResult<PathBuf>
pub fn find_latest_snapshot(&self, model_id: &str) -> HubResult<PathBuf>
Find the latest snapshot of a model.
Sourcepub fn load_config(&self, model_id: &str) -> HubResult<ModelConfig>
pub fn load_config(&self, model_id: &str) -> HubResult<ModelConfig>
Load model configuration.
Sourcepub fn list_cached(&self) -> Vec<String>
pub fn list_cached(&self) -> Vec<String>
List all cached models.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FerrotensorHub
impl RefUnwindSafe for FerrotensorHub
impl Send for FerrotensorHub
impl Sync for FerrotensorHub
impl Unpin for FerrotensorHub
impl UnsafeUnpin for FerrotensorHub
impl UnwindSafe for FerrotensorHub
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