fix: avoid program exit on repo fetch failures

This commit is contained in:
drbh 2024-01-15 18:09:31 -05:00
parent fb6c220dc8
commit 4a47f66da1

View File

@ -176,7 +176,13 @@ async fn main() -> Result<(), RouterError> {
// Initialize API if needed // Initialize API if needed
let api = if use_api { let api = if use_api {
tracing::info!("Using the Hugging Face API"); tracing::info!("Using the Hugging Face API");
Some(api_builder().build().unwrap()) match api_builder().build() {
Ok(api) => Some(api),
Err(_) => {
tracing::warn!("Unable to build the Hugging Face API");
None
}
}
} else { } else {
None None
}; };
@ -232,7 +238,10 @@ async fn main() -> Result<(), RouterError> {
revision.unwrap_or_else(|| "main".to_string()), revision.unwrap_or_else(|| "main".to_string()),
))) )))
.await .await
.unwrap() .unwrap_or_else(|| {
tracing::warn!("Could not retrieve tokenizer config from the Hugging Face hub.");
HubTokenizerConfig::default()
})
} else { } else {
tracing::warn!("Could not find tokenizer config locally and no revision specified"); tracing::warn!("Could not find tokenizer config locally and no revision specified");
HubTokenizerConfig::default() HubTokenizerConfig::default()