MCPcopy Create free account
hub / github.com/evilsocket/cake / hf_cache_dir

Function hf_cache_dir

cake-core/src/utils/hf.rs:86–106  ·  view source on GitHub ↗

Return the HuggingFace hub cache directory if it exists.

()

Source from the content-addressed store, hash-verified

84
85/// Return the HuggingFace hub cache directory if it exists.
86pub fn hf_cache_dir() -> Option<PathBuf> {
87 if let Ok(dir) = std::env::var("HF_HUB_CACHE") {
88 let p = PathBuf::from(dir);
89 if p.exists() {
90 return Some(p);
91 }
92 }
93 if let Ok(dir) = std::env::var("HF_HOME") {
94 let p = PathBuf::from(dir).join("hub");
95 if p.exists() {
96 return Some(p);
97 }
98 }
99 let home = dirs::home_dir()?;
100 let p = home.join(".cache/huggingface/hub");
101 if p.exists() {
102 Some(p)
103 } else {
104 None
105 }
106}
107
108/// Downloads all required model files from HuggingFace Hub.
109/// Returns the local directory path containing the downloaded files.

Callers 2

find_cached_modelFunction · 0.70

Calls

no outgoing calls

Tested by 1