Fix bench_serving fail when zero warmup requests (#5574)

This commit is contained in:
fzyzcjy
2025-04-21 05:16:03 +08:00
committed by GitHub
parent fbdc94ba59
commit 9924bbe153

View File

@@ -690,7 +690,6 @@ def sample_random_requests(
dataset_path: str, dataset_path: str,
random_sample: bool = True, random_sample: bool = True,
) -> List[Tuple[str, int, int]]: ) -> List[Tuple[str, int, int]]:
input_lens = np.random.randint( input_lens = np.random.randint(
max(int(input_len * range_ratio), 1), max(int(input_len * range_ratio), 1),
input_len + 1, input_len + 1,
@@ -1025,7 +1024,9 @@ async def benchmark(
warmup_outputs = await asyncio.gather(*warmup_tasks) warmup_outputs = await asyncio.gather(*warmup_tasks)
# Check if at least one warmup request succeeded # Check if at least one warmup request succeeded
if not any(output.success for output in warmup_outputs): if args.warmup_requests > 0 and not any(
output.success for output in warmup_outputs
):
raise ValueError( raise ValueError(
"Warmup failed - Please make sure benchmark arguments " "Warmup failed - Please make sure benchmark arguments "
f"are correctly specified. Error: {warmup_outputs[0].error}" f"are correctly specified. Error: {warmup_outputs[0].error}"