Skip to content

Add warmup client CLI option #581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ Options:
Unused for gRPC servers

[env: AUTO_TRUNCATE=]

--warmup-model
Send a dummy request to the model before server start-up

[env: WARMUP_MODEL=]

--default-prompt-name <DEFAULT_PROMPT_NAME>
The name of the prompt that should be used by default for encoding. If not set, no prompt will be applied.
Expand Down
4 changes: 4 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@
"max_batch_tokens",
"max_client_batch_size",
"auto_truncate",
"warmup_model",
"tokenization_workers",
"version"
],
Expand Down Expand Up @@ -1129,6 +1130,9 @@
"type": "string",
"description": "Router Info",
"example": "0.5.0"
},
"warmup_model": {
"type": "boolean"
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions docs/source/en/cli_arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ Options:
Unused for gRPC servers
[env: AUTO_TRUNCATE=]
--warmup-model
Send a dummy request to the model before server start-up
[env: WARMUP_MODEL=]
--default-prompt-name <DEFAULT_PROMPT_NAME>
The name of the prompt that should be used by default for encoding. If not set, no prompt will be applied.
Expand Down
5 changes: 4 additions & 1 deletion router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub async fn run(
max_batch_requests: Option<usize>,
max_client_batch_size: usize,
auto_truncate: bool,
warmup_model: bool,
default_prompt: Option<String>,
default_prompt_name: Option<String>,
hf_token: Option<String>,
Expand Down Expand Up @@ -248,7 +249,7 @@ pub async fn run(
.await
.context("Model backend is not healthy")?;

if !backend.padded_model {
if !backend.padded_model || warmup_model {
tracing::info!("Warming up model");
backend
.warmup(max_input_length, max_batch_tokens, max_batch_requests)
Expand Down Expand Up @@ -288,6 +289,7 @@ pub async fn run(
max_batch_requests,
max_client_batch_size,
auto_truncate,
warmup_model,
version: env!("CARGO_PKG_VERSION"),
sha: option_env!("VERGEN_GIT_SHA"),
docker_label: option_env!("DOCKER_LABEL"),
Expand Down Expand Up @@ -510,6 +512,7 @@ pub struct Info {
#[cfg_attr(feature = "http", schema(example = "32"))]
pub max_client_batch_size: usize,
pub auto_truncate: bool,
pub warmup_model: bool,
#[cfg_attr(feature = "http", schema(example = "4"))]
pub tokenization_workers: usize,
/// Router Info
Expand Down
6 changes: 6 additions & 0 deletions router/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ struct Args {
#[clap(long, env)]
auto_truncate: bool,

/// Send a dummy request to the model before server start-up
///
#[clap(long, env)]
warmup_model: bool,

/// The name of the prompt that should be used by default for encoding. If not set, no prompt
/// will be applied.
///
Expand Down Expand Up @@ -216,6 +221,7 @@ async fn main() -> Result<()> {
args.max_batch_requests,
args.max_client_batch_size,
args.auto_truncate,
args.warmup_model,
args.default_prompt,
args.default_prompt_name,
token,
Expand Down