Skip to content

Commit 6355051

Browse files
s3woztdoublep
andauthored
[Bugfix] Correct prompt lengths for timed_traces benchmark (#45423)
Signed-off-by: Stanislaw Wozniak <stw@zurich.ibm.com> Co-authored-by: Thomas Parnell <tpa@zurich.ibm.com>
1 parent b652ded commit 6355051

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

vllm/benchmarks/datasets/datasets.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class SampleRequest:
7979
Represents a single inference request for benchmarking.
8080
"""
8181

82-
prompt: str | list[str] | list[dict]
82+
prompt: str | list[str] | list[int] | list[dict]
8383
prompt_len: int
8484
expected_output_len: int = 0
8585
multi_modal_data: MultiModalDataDict | dict | list[dict] | None = None
@@ -1572,7 +1572,6 @@ def sample(
15721572
prompt_ids = self._expand_prompt(
15731573
entry.get(self.label_hash_ids, []), input_length, tokenizer
15741574
)
1575-
prompt = tokenizer.decode(prompt_ids)
15761575

15771576
# Get timestamp with proper error handling
15781577
ts_value = entry.get(self.label_ts)
@@ -1588,7 +1587,7 @@ def sample(
15881587

15891588
samples.append(
15901589
SampleRequest(
1591-
prompt=prompt,
1590+
prompt=prompt_ids,
15921591
prompt_len=prompt_len,
15931592
expected_output_len=new_output_len,
15941593
lora_request=None,

vllm/benchmarks/lib/endpoint_request_func.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def add_chunk(self, chunk_bytes: bytes) -> list[str]:
6666
class RequestFuncInput:
6767
"""The input for the request function."""
6868

69-
prompt: str | list[str] | list[dict[str, Any]]
69+
prompt: str | list[str] | list[int] | list[dict[str, Any]]
7070
api_url: str
7171
prompt_len: int
7272
output_len: int

vllm/benchmarks/serve.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,6 +2097,11 @@ async def main_async(args: argparse.Namespace) -> dict[str, Any]:
20972097
args.ignore_eos = True
20982098

20992099
if args.dataset_name == "timed_trace":
2100+
if args.backend not in ("vllm", "openai"):
2101+
raise ValueError(
2102+
"timed_trace dataset passes pre-tokenized prompts (list[int])"
2103+
" and requires a completions backend ('vllm' or 'openai')."
2104+
)
21002105
# timed_trace carries per-request timestamps;
21012106
# ignore EOS so generation runs to the trace's specified output length,
21022107
# and default to using those timestamps for scheduling unless the user

0 commit comments

Comments
 (0)