From 57c313df9cb4340bdf5cb4a538aff0e3f10c7abf Mon Sep 17 00:00:00 2001 From: ErikKaumk Date: Fri, 12 Jul 2024 14:35:51 +0200 Subject: [PATCH] fix to not ignore HUGGINGFACE_HUB_CACHE in cache --- router/src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/router/src/main.rs b/router/src/main.rs index 21cd6649..4129afc6 100644 --- a/router/src/main.rs +++ b/router/src/main.rs @@ -210,7 +210,11 @@ async fn main() -> Result<(), RouterError> { } 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 { @@ -291,6 +295,10 @@ async fn main() -> Result<(), RouterError> { ) } }; + + println!("tokenizer_filename: {:?}", tokenizer_filename); + + let config: Option = config_filename.and_then(|filename| { std::fs::read_to_string(filename) .ok() @@ -348,6 +356,8 @@ async fn main() -> Result<(), RouterError> { tracing::warn!("Rust input length validation and truncation is disabled"); } + println!("Using config {config:?}"); + // if pipeline-tag == text-generation we default to return_full_text = true let compat_return_full_text = match &model_info.pipeline_tag { None => {