[Benchmark] Enable reasoning-model (thinking) benchmarking via --chat-template-kwargs for client-rendered datasets (#44244)

Signed-off-by: Albert Cheng <albertching0112@gmail.com>
This commit is contained in:
Albert Cheng
2026-06-02 22:49:51 -07:00
committed by GitHub
parent f0204358d9
commit e0081ef8cf
3 changed files with 88 additions and 0 deletions
+4
View File
@@ -2080,6 +2080,7 @@ def get_samples(args, tokenizer: TokenizerLike) -> list[SampleRequest]:
tokenizer=tokenizer,
output_len=args.custom_output_len,
skip_chat_template=args.skip_chat_template,
chat_template_kwargs=getattr(args, "chat_template_kwargs", None),
request_id_prefix=args.request_id_prefix,
no_oversample=args.no_oversample,
)
@@ -2409,6 +2410,7 @@ def get_samples(args, tokenizer: TokenizerLike) -> list[SampleRequest]:
num_requests=args.num_prompts,
tokenizer=tokenizer,
output_len=args.speed_bench_output_len,
chat_template_kwargs=getattr(args, "chat_template_kwargs", None),
enable_multimodal_chat=args.enable_multimodal_chat,
request_id_prefix=args.request_id_prefix,
no_oversample=args.no_oversample,
@@ -2496,6 +2498,7 @@ class CustomDataset(BenchmarkDataset):
output_len: int | None = None,
enable_multimodal_chat: bool = False,
skip_chat_template: bool = False,
chat_template_kwargs: dict | None = None,
**kwargs,
) -> list[SampleRequest]:
# load all data if needed
@@ -2543,6 +2546,7 @@ class CustomDataset(BenchmarkDataset):
[{"role": "user", "content": prompt}],
add_generation_prompt=True,
tokenize=False,
**(chat_template_kwargs or {}),
)
prompt_len = len(tokenizer(prompt).input_ids)
+9
View File
@@ -1609,6 +1609,15 @@ def add_cli_args(parser: argparse.ArgumentParser):
"in seconds. Ready check will be skipped by default.",
)
parser.add_argument(
"--chat-template-kwargs",
type=json.loads,
default=None,
help="A JSON string of kwargs forwarded to the tokenizer's "
"apply_chat_template when a dataset renders prompts client-side "
"(e.g. custom / speed_bench). "
"Example: '{\"thinking\": true}' to enable reasoning models.",
)
parser.add_argument(
"--extra-body",
help="A JSON string representing extra body parameters to include "