Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ pub async fn run(

tracing::info!("Maximum number of tokens per request: {max_input_length}");

let tokenization_workers = tokenization_workers.unwrap_or_else(num_cpus::get);

// fall-back to num_cpus - 1 to leave some CPU for the backend, and at most 64 workers.
let tokenization_workers =
tokenization_workers.unwrap_or_else(|| std::cmp::min(std::cmp::max(1, num_cpus::get() - 1), 64));

// Try to load new ST Config
let mut new_st_config: Option<NewSTConfig> = None;
let config_path = model_root.join("config_sentence_transformers.json");
Expand Down