pub struct Cache { /* private fields */ }
Expand description
A local struct used to fetch information from the cache folder.
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Creates cache from environment variable HF_HOME (if defined) otherwise
defaults to [home_dir
]/.cache/huggingface/
Sourcepub fn token_path(&self) -> PathBuf
pub fn token_path(&self) -> PathBuf
Returns the location of the token file
Sourcepub fn token(&self) -> Option<String>
pub fn token(&self) -> Option<String>
Returns the token value if it exists in the cache
Use huggingface-cli login
to set it up.
Sourcepub fn model(&self, model_id: String) -> CacheRepo
pub fn model(&self, model_id: String) -> CacheRepo
Simple wrapper over
let cache = Cache::new("/tmp/".into());
let cache = cache.repo(Repo::new(model_id, RepoType::Model));
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
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