This commit is contained in:
Nicolas Patry 2024-07-30 18:21:11 +02:00
parent bbdd26e2be
commit 9357fc162a
No known key found for this signature in database
GPG Key ID: E939E8CC91A1C674
1 changed files with 4 additions and 1 deletions

View File

@ -1553,7 +1553,10 @@ pub async fn run(
}
let api = if use_api {
if std::env::var("HF_HUB_OFFLINE") == Ok("1".to_string()) {
let cache = Cache::default();
let cache = std::env::var("HUGGINGFACE_HUB_CACHE")
.map_err(|_| ())
.map(|cache_dir| Cache::new(cache_dir.into()))
.unwrap_or_else(|_| Cache::default());
tracing::warn!("Offline mode active using cache defaults");
Type::Cache(cache)
} else {