@@ -215,6 +215,11 @@ def calculate_metrics(
215
215
else :
216
216
actual_output_lens .append (0 )
217
217
218
+ if completed == 0 :
219
+ warnings .warn (
220
+ "All requests failed. This is likely due to a misconfiguration "
221
+ "on the benchmark arguments." ,
222
+ stacklevel = 2 )
218
223
metrics = BenchmarkMetrics (
219
224
completed = completed ,
220
225
total_input = total_input ,
@@ -226,9 +231,9 @@ def calculate_metrics(
226
231
1000 , # ttfts is empty if streaming is not supported by backend
227
232
median_ttft_ms = np .median (ttfts or 0 ) * 1000 ,
228
233
p99_ttft_ms = np .percentile (ttfts or 0 , 99 ) * 1000 ,
229
- mean_tpot_ms = np .mean (tpots ) * 1000 ,
230
- median_tpot_ms = np .median (tpots ) * 1000 ,
231
- p99_tpot_ms = np .percentile (tpots , 99 ) * 1000 ,
234
+ mean_tpot_ms = np .mean (tpots or 0 ) * 1000 ,
235
+ median_tpot_ms = np .median (tpots or 0 ) * 1000 ,
236
+ p99_tpot_ms = np .percentile (tpots or 0 , 99 ) * 1000 ,
232
237
)
233
238
234
239
return metrics , actual_output_lens
@@ -250,6 +255,24 @@ async def benchmark(
250
255
else :
251
256
raise ValueError (f"Unknown backend: { backend } " )
252
257
258
+ print ("Starting initial single prompt test run..." )
259
+ test_prompt , test_prompt_len , test_output_len = input_requests [0 ]
260
+ test_input = RequestFuncInput (
261
+ model = model_id ,
262
+ prompt = test_prompt ,
263
+ api_url = api_url ,
264
+ prompt_len = test_prompt_len ,
265
+ output_len = test_output_len ,
266
+ best_of = best_of ,
267
+ use_beam_search = use_beam_search ,
268
+ )
269
+ test_output = await request_func (request_func_input = test_input )
270
+ if not test_output .success :
271
+ raise ValueError (
272
+ "Initial test run failed - Please make sure benchmark arguments "
273
+ f"are correctly specified. Error: { test_output .error } " )
274
+ else :
275
+ print ("Initial test run completed. Starting main benchmark run..." )
253
276
print (f"Traffic request rate: { request_rate } " )
254
277
255
278
pbar = None if disable_tqdm else tqdm (total = len (input_requests ))
0 commit comments