Repository navigation
[Bugfix][Benchmark] Check readiness before tokenizer init in rust vllm-bench #51863
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ use crate::metrics::steady_state; | |
| use crate::output::console::print_results; | ||
| use crate::output::json::{append_result, build_result_json, compute_result_filename, save_result}; | ||
| use crate::rate_control::compute_schedule; | ||
| use crate::ready_checker::wait_for_endpoint; | ||
| use crate::ready_checker::run_initial_ready_check; | ||
|
|
||
| /// Pre-resolve the hostname in `base_url` and pin all resolved IPs on the | ||
| /// client builder via [`reqwest::ClientBuilder::resolve_to_addrs`]. This | ||
|
|
@@ -358,6 +358,8 @@ pub async fn run_benchmark(config: &BenchConfig) -> Result<serde_json::Value> { | |
| (id, Some(name)) | ||
| }; | ||
|
|
||
| run_initial_ready_check(config, &client, &model_id, &model_name).await?; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [efficiency] This serializes the server-boot wait before tokenizer load and dataset generation instead of overlapping them. On main, dataset generation (minutes for large random/HF datasets) ran while the server booted, and the ready check at the end consumed only the remaining boot time; now wall-clock startup is A cheaper shape that keeps the fix: spawn the ready check as a concurrent task here and |
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [correctness — plausible] With the probe moved before tokenizer download and dataset generation (which can take minutes for HF tokenizer fetch / ShareGPT / 100k-prompt random datasets), readiness is stale by the time the timed run starts:
Same applies to |
||
| // Load tokenizer (if needed) | ||
| let tokenizer = if config.skip_tokenizer_init { | ||
| None | ||
|
|
@@ -681,26 +683,6 @@ pub async fn run_benchmark(config: &BenchConfig) -> Result<serde_json::Value> { | |
| prompt_list: first.prompt_list.clone(), | ||
| }; | ||
|
|
||
| // Ready check | ||
| if config.ready_check_timeout_sec > 0 { | ||
| tracing::info!("starting initial single-prompt test run"); | ||
| let test_output = wait_for_endpoint( | ||
| config.backend, | ||
| &client, | ||
| &test_input, | ||
| config.ready_check_timeout_sec, | ||
| 5, | ||
| ) | ||
| .await?; | ||
| if !test_output.success { | ||
| return Err(BenchError::Backend(format!( | ||
| "Initial test run failed: {}", | ||
| test_output.error | ||
| ))); | ||
| } | ||
| tracing::info!("initial single-prompt test run completed"); | ||
| } | ||
|
|
||
| // Verify and fix prompt token lengths against the server's /tokenize endpoint. | ||
| // Runs after the ready check so a still-starting server isn't mistaken for a | ||
| // tokenize failure, and after the dry-run exit so dry runs stay offline. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,61 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // SPDX-FileCopyrightText: Copyright contributors to the vLLM project | ||
|
|
||
| use std::sync::Arc; | ||
| use std::time::Instant; | ||
|
|
||
| use indicatif::{ProgressBar, ProgressStyle}; | ||
|
|
||
| use crate::backends::{RequestFuncInput, RequestFuncOutput, get_backend}; | ||
| use crate::cli::BackendKind; | ||
| use crate::config::BenchConfig; | ||
| use crate::error::{BenchError, Result}; | ||
|
|
||
| /// Wait for the configured backend before tokenizer and dataset initialization. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [conventions] The move dropped the original inline comments — |
||
| pub async fn run_initial_ready_check( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [test-coverage] |
||
| config: &BenchConfig, | ||
| client: &reqwest::Client, | ||
| model_id: &str, | ||
| model_name: &Option<String>, | ||
| ) -> Result<()> { | ||
| if config.dry_run || config.ready_check_timeout_sec == 0 { | ||
| return Ok(()); | ||
| } | ||
|
|
||
| let prompt_list = (config.backend == BackendKind::VllmRerank).then(|| { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [simplification] This rerank special case duplicates the pooling backend's payload contract ( A probe-input constructor owned by the backend layer (e.g. a method on |
||
| Arc::from([ | ||
| Arc::<str>::from("test query"), | ||
| Arc::<str>::from("test document"), | ||
| ]) | ||
| }); | ||
| let test_input = RequestFuncInput { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [correctness — confirmed] The ready check no longer exercises the real benchmark request shape — Example: a multimodal dataset (VisionArena via openai-chat) against a model that rejects image input. Previously every probe got the server's 400 and the run aborted early with the underlying error in Deriving the probe from the first dataset request (as before) while keeping the new early placement would need the dataset ready first — which conflicts with the goal here — but the probe could at least carry the request-shape-relevant fields once the dataset exists, e.g. by keeping a second shape-check before the timed run (see the staleness comment on |
||
| prompt: Arc::from("test"), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [correctness — confirmed] The probe sends a text prompt ( The removed single-turn ready check cloned |
||
| api_url: config.api_url.clone(), | ||
| prompt_len: 1, | ||
| output_len: 1, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [correctness — confirmed] The synthetic probe hardcodes The removed code used the first dataset request's |
||
| model: model_id.to_string(), | ||
| model_name: model_name.clone(), | ||
| logprobs: config.logprobs, | ||
| extra_headers: config.extra_headers.clone(), | ||
| extra_body: config.extra_body.clone(), | ||
| ignore_eos: config.ignore_eos, | ||
| prompt_list, | ||
| ..Default::default() | ||
| }; | ||
|
|
||
| tracing::info!("starting initial single-prompt test run"); | ||
| wait_for_endpoint( | ||
| config.backend, | ||
| client, | ||
| &test_input, | ||
| config.ready_check_timeout_sec, | ||
| 5, | ||
| ) | ||
| .await?; | ||
| tracing::info!("initial single-prompt test run completed"); | ||
| Ok(()) | ||
| } | ||
|
|
||
| /// Wait for the serving endpoint to become available. | ||
| /// | ||
| /// Sends test requests with retry until success or timeout. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[correctness — confirmed] Model auto-resolution still hits the server before this ready check, so the readiness timeout never applies when
--modelis omitted.When
--modelis omitted while the server is still starting (the exact scenario this PR targets),get_first_model_from_server(line 352) sends a single unretriedGET /v1/models(request.send().await?) beforerun_initial_ready_checkis reached, so the benchmark exits immediately with a connection-refused error instead of waiting--ready-check-timeout-sec. Same gap inrun_multi_turn_benchmark(multi_turn.rs:77viaget_first_model).Consider moving the ready check above model resolution (probing a health-ish endpoint first), or retrying the
/v1/modelsfetch under the same timeout.