From 5fbab20e021a4febbeda830eaa15a2deb598c01e Mon Sep 17 00:00:00 2001 From: Chenyaaang <42742451+Chenyaaang@users.noreply.github.com> Date: Thu, 10 Apr 2025 11:35:41 -0700 Subject: [PATCH] [Bugfix] Fix bug when dataset is json (#15899) Signed-off-by: Chenyaaang --- benchmarks/benchmark_serving_structured_output.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/benchmarks/benchmark_serving_structured_output.py b/benchmarks/benchmark_serving_structured_output.py index 6d3ba6c025ae..7ad0791a9868 100644 --- a/benchmarks/benchmark_serving_structured_output.py +++ b/benchmarks/benchmark_serving_structured_output.py @@ -130,10 +130,11 @@ def sample_requests(tokenizer: PreTrainedTokenizerBase, "description": "An unique optional field to avoid cached schemas" } + else: + json_schemas = [schema] * args.num_prompts def gen_prompt(index: int): - schema = json_schemas[index % len(json_schemas)] - return f"Generate an example of a user profile given the following schema: {json.dumps(schema)}" # noqa: E501 + return f"Generate an example of a user profile given the following schema: {json.dumps(get_schema(index))}" # noqa: E501 def get_schema(index: int): return json_schemas[index % len(json_schemas)]