-
-
Notifications
You must be signed in to change notification settings - Fork 21k
[Pooling] Report input throughput for batched requests #53213
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
base: main
Are you sure you want to change the base?
Changes from all commits
3d6013f
fc2928a
fcefe0c
80e3fef
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 |
|---|---|---|
|
|
@@ -98,6 +98,16 @@ pub fn build_result_json( | |
| "request_throughput".into(), | ||
| serde_json::json!(metrics.request_throughput), | ||
| ); | ||
| if is_pooling { | ||
| result.insert( | ||
| "total_input_sequences".into(), | ||
| serde_json::json!(metrics.total_input_sequences), | ||
| ); | ||
| result.insert( | ||
| "input_sequence_throughput".into(), | ||
| serde_json::json!(metrics.input_sequence_throughput), | ||
| ); | ||
|
Comment on lines
+106
to
+109
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. Should we also expose this metric in the Rust compare, multi-run, and sweep summaries? |
||
| } | ||
| if config.goodput.is_empty() { | ||
| result.insert("request_goodput".into(), Value::Null); | ||
| } else { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,7 +66,7 @@ def add_chunk(self, chunk_bytes: bytes) -> list[str]: | |
| class RequestFuncInput: | ||
| """The input for the request function.""" | ||
|
|
||
| prompt: str | list[str] | list[int] | list[dict[str, Any]] | ||
| prompt: str | list[str] | list[int] | list[list[int]] | list[dict[str, Any]] | ||
| api_url: str | ||
| prompt_len: int | ||
| output_len: int | ||
|
|
@@ -100,6 +100,7 @@ class RequestFuncOutput: | |
| error: str = "" | ||
| start_time: float = 0.0 | ||
| input_audio_duration: float = 0.0 # in seconds | ||
| num_input_sequences: int = 1 | ||
|
|
||
|
|
||
| class RequestFunc(Protocol): | ||
|
|
@@ -586,8 +587,9 @@ async def _run_pooling_request( | |
| payload: dict[str, Any], | ||
| headers: dict[str, Any], | ||
| pbar: tqdm | None = None, | ||
| num_input_sequences: int = 1, | ||
| ) -> RequestFuncOutput: | ||
| output = RequestFuncOutput() | ||
| output = RequestFuncOutput(num_input_sequences=num_input_sequences) | ||
| st = time.perf_counter() | ||
| output.start_time = st | ||
| try: | ||
|
|
@@ -617,6 +619,12 @@ async def _run_pooling_request( | |
| return output | ||
|
|
||
|
|
||
| def _get_num_input_sequences(prompt: Any) -> int: | ||
| if prompt and isinstance(prompt, list) and isinstance(prompt[0], (str, list)): | ||
| return len(prompt) | ||
| return 1 | ||
|
Comment on lines
+622
to
+625
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. Will list[list[int]] be supported?
Contributor
Author
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. Very good point. The current helper treats list[list[int]] as one input. I’ll count both list[str] and list[list[int]] as batches while preserving list[int] as a single input, and update the type annotations accordingly. Reproducer to test:.vent/bin/python - <<'PY'
from vllm.benchmarks.lib.endpoint_request_func import _get_num_input_sequences
cases = [
("text batch", ["a", "b"], 2),
("token-ID batch", [[101, 102], [103, 104]], 2),
("single token-ID input", [101, 102], 1),
("chat content", [{"type": "text", "text": "hello"}], 1),
]
for name, value, expected in cases:
actual = _get_num_input_sequences(value)
print(f"{name}: expected={expected}, actual={actual}")
assert actual == expected
print("All input-shape checks passed")
PYPrior to the latest commit, we get an After making the changes, it passes: Thanks for the review! |
||
|
|
||
|
|
||
| async def async_request_openai_embeddings( | ||
| request_func_input: RequestFuncInput, | ||
| session: aiohttp.ClientSession, | ||
|
|
@@ -645,6 +653,7 @@ async def async_request_openai_embeddings( | |
| payload=payload, | ||
| headers=headers, | ||
| pbar=pbar, | ||
| num_input_sequences=_get_num_input_sequences(request_func_input.prompt), | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -681,6 +690,7 @@ async def async_request_vllm_rerank( | |
| payload=payload, | ||
| headers=headers, | ||
| pbar=pbar, | ||
| num_input_sequences=len(request_func_input.prompt) - 1, | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -818,6 +828,7 @@ async def async_request_infinity_embeddings( | |
| payload=payload, | ||
| headers=headers, | ||
| pbar=pbar, | ||
| num_input_sequences=_get_num_input_sequences(request_func_input.prompt), | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -866,6 +877,7 @@ async def async_request_vllm_pooling( | |
| payload=payload, | ||
| headers=headers, | ||
| pbar=pbar, | ||
| num_input_sequences=_get_num_input_sequences(request_func_input.prompt), | ||
| ) | ||
|
|
||
|
|
||
|
|
||
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.
When
prompt_list is None, documents can still come fromextra_body, but this always reports one input even if multiple documents are sent?