From 57c313df9cb4340bdf5cb4a538aff0e3f10c7abf Mon Sep 17 00:00:00 2001 From: ErikKaumk Date: Fri, 12 Jul 2024 14:35:51 +0200 Subject: [PATCH 1/4] 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 21cd66496da..4129afc60b6 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 => { From 3a1482720f10579ebec9abdfeef64faeefe50474 Mon Sep 17 00:00:00 2001 From: ErikKaumk Date: Fri, 12 Jul 2024 14:44:15 +0200 Subject: [PATCH 2/4] delete printlns --- router/src/main.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/router/src/main.rs b/router/src/main.rs index 4129afc60b6..51bb5f90dff 100644 --- a/router/src/main.rs +++ b/router/src/main.rs @@ -296,7 +296,6 @@ async fn main() -> Result<(), RouterError> { } }; - println!("tokenizer_filename: {:?}", tokenizer_filename); let config: Option = config_filename.and_then(|filename| { @@ -356,7 +355,6 @@ 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 { From 30ce9e042620700a88a628a4a2b253b2d110b3ad Mon Sep 17 00:00:00 2001 From: ErikKaumk Date: Fri, 12 Jul 2024 14:47:17 +0200 Subject: [PATCH 3/4] delete newlines --- router/src/main.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/router/src/main.rs b/router/src/main.rs index 51bb5f90dff..ce3809c86bf 100644 --- a/router/src/main.rs +++ b/router/src/main.rs @@ -295,9 +295,6 @@ async fn main() -> Result<(), RouterError> { ) } }; - - - let config: Option = config_filename.and_then(|filename| { std::fs::read_to_string(filename) .ok() @@ -355,7 +352,6 @@ async fn main() -> Result<(), RouterError> { tracing::warn!("Rust input length validation and truncation is disabled"); } - // if pipeline-tag == text-generation we default to return_full_text = true let compat_return_full_text = match &model_info.pipeline_tag { None => { From dc64f8a3a87c45509b7a82ffc2368d8791e5ce5b Mon Sep 17 00:00:00 2001 From: ErikKaumk Date: Mon, 15 Jul 2024 09:53:11 +0200 Subject: [PATCH 4/4] maybe fix trailing whitespace --- router/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/src/main.rs b/router/src/main.rs index ce3809c86bf..b060d73cf30 100644 --- a/router/src/main.rs +++ b/router/src/main.rs @@ -214,7 +214,7 @@ async fn main() -> Result<(), RouterError> { .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 {