Skip to content

Commit

Permalink
fix: show warning with tokenizer config parsing error (#1488)
Browse files Browse the repository at this point in the history
This tiny PR just prints the parsing error when a tokenizer config fails
to load.

This is helpful when a chat_template wont load due to formatting issues
huggingface/text-generation-inference#1427 (comment)
  • Loading branch information
cr313 committed Jan 26, 2024
1 parent 1b5d79b commit 8681436
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion router/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,12 @@ pub async fn get_tokenizer_config(api_repo: &ApiRepo) -> Option<HubTokenizerConf
let reader = BufReader::new(file);

// Read the JSON contents of the file as an instance of 'HubTokenizerConfig'.
let tokenizer_config: HubTokenizerConfig = serde_json::from_reader(reader).ok()?;
let tokenizer_config: HubTokenizerConfig = serde_json::from_reader(reader)
.map_err(|e| {
tracing::warn!("Unable to parse tokenizer config: {}", e);
e
})
.ok()?;

Some(tokenizer_config)
}
Expand Down

0 comments on commit 8681436

Please sign in to comment.