diff --git a/vllm/benchmarks/datasets/datasets.py b/vllm/benchmarks/datasets/datasets.py index 2db092580a..d928123dde 100644 --- a/vllm/benchmarks/datasets/datasets.py +++ b/vllm/benchmarks/datasets/datasets.py @@ -79,7 +79,7 @@ class SampleRequest: Represents a single inference request for benchmarking. """ - prompt: str | list[str] | list[dict] + prompt: str | list[str] | list[int] | list[dict] prompt_len: int expected_output_len: int = 0 multi_modal_data: MultiModalDataDict | dict | list[dict] | None = None @@ -1572,7 +1572,6 @@ class TimedTrace(BenchmarkDataset): prompt_ids = self._expand_prompt( entry.get(self.label_hash_ids, []), input_length, tokenizer ) - prompt = tokenizer.decode(prompt_ids) # Get timestamp with proper error handling ts_value = entry.get(self.label_ts) @@ -1588,7 +1587,7 @@ class TimedTrace(BenchmarkDataset): samples.append( SampleRequest( - prompt=prompt, + prompt=prompt_ids, prompt_len=prompt_len, expected_output_len=new_output_len, lora_request=None, diff --git a/vllm/benchmarks/lib/endpoint_request_func.py b/vllm/benchmarks/lib/endpoint_request_func.py index 59cbc0e2e6..1023700da4 100644 --- a/vllm/benchmarks/lib/endpoint_request_func.py +++ b/vllm/benchmarks/lib/endpoint_request_func.py @@ -66,7 +66,7 @@ class StreamedResponseHandler: class RequestFuncInput: """The input for the request function.""" - prompt: str | list[str] | list[dict[str, Any]] + prompt: str | list[str] | list[int] | list[dict[str, Any]] api_url: str prompt_len: int output_len: int diff --git a/vllm/benchmarks/serve.py b/vllm/benchmarks/serve.py index e4ab5a583a..9b99368923 100644 --- a/vllm/benchmarks/serve.py +++ b/vllm/benchmarks/serve.py @@ -2097,6 +2097,11 @@ async def main_async(args: argparse.Namespace) -> dict[str, Any]: args.ignore_eos = True if args.dataset_name == "timed_trace": + if args.backend not in ("vllm", "openai"): + raise ValueError( + "timed_trace dataset passes pre-tokenized prompts (list[int])" + " and requires a completions backend ('vllm' or 'openai')." + ) # timed_trace carries per-request timestamps; # ignore EOS so generation runs to the trace's specified output length, # and default to using those timestamps for scheduling unless the user