Unverified Commit 457fb0a1 authored by Erik Kaunismäki's avatar Erik Kaunismäki Committed by GitHub
Browse files

fix custom cache dir (#2226)

* fix to not ignore HUGGINGFACE_HUB_CACHE in cache

* delete printlns

* delete newlines

* maybe fix trailing whitespace
parent 5a650669
...@@ -210,7 +210,11 @@ async fn main() -> Result<(), RouterError> { ...@@ -210,7 +210,11 @@ async fn main() -> Result<(), RouterError> {
} }
let api = if use_api { let api = if use_api {
if std::env::var("HF_HUB_OFFLINE") == Ok("1".to_string()) { 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"); tracing::warn!("Offline mode active using cache defaults");
Type::Cache(cache) Type::Cache(cache)
} else { } else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment