Skip to content

Commit e192a87

Browse files
committed
Revert "fix: Fix missing key (NVIDIA#6471)"
This reverts commit 48768fd. Revert "Add Acceptance Rate calculation to benchmark_serving (NVIDIA#6240)" This reverts commit c9b8b61. Signed-off-by: Zero Zeng <[email protected]>
1 parent 294e0d3 commit e192a87

File tree

2 files changed

+9
-71
lines changed

2 files changed

+9
-71
lines changed

tensorrt_llm/serve/scripts/backend_request_func.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class RequestFuncOutput:
4444
tpot: float = 0.0 # avg next-token latencies
4545
prompt_len: int = 0
4646
error: str = ""
47-
decode_iteration: int = 0 # Number of decoding iterations
4847

4948

5049
async def async_request_trt_llm(
@@ -78,7 +77,6 @@ async def async_request_trt_llm(
7877
ttft = 0.0
7978
st = time.perf_counter()
8079
most_recent_timestamp = st
81-
decode_iteration_count = 0 # Track decoding iterations
8280
try:
8381
async with request_session.post(url=api_url, json=payload) as response:
8482
if response.status == 200:
@@ -104,22 +102,16 @@ async def async_request_trt_llm(
104102
else:
105103
output.itl.append(timestamp - most_recent_timestamp)
106104

107-
# Increment decode iteration for each chunk
108-
decode_iteration_count += 1
109105
most_recent_timestamp = timestamp
110106

111107
output.latency = most_recent_timestamp - st
112-
output.decode_iteration = decode_iteration_count
113108
else:
114109
content = await response.content.read()
115110
data = json.loads(content.decode())
116111
output.ttft = -1
117112
output.itl = []
118113
output.generated_text = data["text_output"]
119114
output.latency = time.perf_counter() - st
120-
# For non-streaming, estimate decode_iteration as number of output tokens
121-
output.decode_iteration = len(output.generated_text.split(
122-
)) if output.generated_text else 1
123115

124116
else:
125117
output.error = response.reason or ""
@@ -178,7 +170,6 @@ async def async_request_openai_completions(
178170
generated_text = ""
179171
st = time.perf_counter()
180172
most_recent_timestamp = st
181-
decode_iteration_count = 0 # Track decoding iterations
182173
try:
183174
async with request_session.post(url=api_url,
184175
json=payload,
@@ -215,9 +206,6 @@ async def async_request_openai_completions(
215206
output.itl.append(timestamp -
216207
most_recent_timestamp)
217208

218-
# Increment decode iteration for each chunk with text
219-
if text is not None:
220-
decode_iteration_count += 1
221209
most_recent_timestamp = timestamp
222210
generated_text += text or ""
223211
elif usage := data.get("usage"):
@@ -232,7 +220,6 @@ async def async_request_openai_completions(
232220
"This response will be marked as failed!")
233221
output.generated_text = generated_text
234222
output.latency = most_recent_timestamp - st
235-
output.decode_iteration = decode_iteration_count
236223
else:
237224
content = await response.content.read()
238225
data = json.loads(content.decode())
@@ -243,8 +230,6 @@ async def async_request_openai_completions(
243230
output.ttft = -1
244231
output.itl = []
245232
output.output_tokens = data["usage"]["completion_tokens"]
246-
# For non-streaming, estimate decode_iteration as number of output tokens
247-
output.decode_iteration = output.output_tokens if output.output_tokens > 0 else 1
248233
else:
249234
output.error = response.reason or ""
250235
output.success = False
@@ -321,7 +306,6 @@ async def async_request_openai_chat_completions(
321306
ttft = 0.0
322307
st = time.perf_counter()
323308
most_recent_timestamp = st
324-
decode_iteration_count = 0 # Track decoding iterations
325309
try:
326310
async with request_session.post(url=api_url,
327311
json=payload,
@@ -352,9 +336,6 @@ async def async_request_openai_chat_completions(
352336
output.itl.append(timestamp -
353337
most_recent_timestamp)
354338

355-
# Increment decode iteration for each chunk with content
356-
if content is not None:
357-
decode_iteration_count += 1
358339
generated_text += content or ""
359340
elif usage := data.get("usage"):
360341
output.output_tokens = usage.get(
@@ -364,7 +345,6 @@ async def async_request_openai_chat_completions(
364345

365346
output.generated_text = generated_text
366347
output.latency = most_recent_timestamp - st
367-
output.decode_iteration = decode_iteration_count
368348
else:
369349
content = await response.content.read()
370350
data = json.loads(content.decode())
@@ -374,8 +354,6 @@ async def async_request_openai_chat_completions(
374354
output.itl = []
375355
output.latency = time.perf_counter() - st
376356
output.ttft = -1
377-
# For non-streaming, estimate decode_iteration as number of output tokens
378-
output.decode_iteration = output.output_tokens if output.output_tokens > 0 else 1
379357

380358
else:
381359
output.error = response.reason or ""

tensorrt_llm/serve/scripts/benchmark_serving.py

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ class BenchmarkMetrics:
7979
std_e2el_ms: float
8080
percentiles_e2el_ms: list[tuple[float, float]]
8181
tput_user: list[float]
82-
# Request accuracy rate metrics
83-
mean_request_ar: float
84-
median_request_ar: float
85-
std_request_ar: float
86-
percentiles_request_ar: list[tuple[float, float]]
8782

8883

8984
async def get_request(
@@ -136,7 +131,7 @@ def calculate_metrics(
136131
selected_percentile_metrics: list[str],
137132
selected_percentiles: list[float],
138133
goodput_config_dict: dict[str, float],
139-
) -> tuple[BenchmarkMetrics, list[int], list[float]]:
134+
) -> tuple[BenchmarkMetrics, list[int]]:
140135
actual_output_lens: list[int] = []
141136
total_input = 0
142137
completed = 0
@@ -147,7 +142,6 @@ def calculate_metrics(
147142
ttfts: list[float] = []
148143
e2els: list[float] = []
149144
tput_user: list[float] = []
150-
request_ars: list[float] = [] # Request accuracy rates
151145
for i in range(len(outputs)):
152146
if outputs[i].success:
153147
output_len = outputs[i].output_tokens
@@ -173,24 +167,9 @@ def calculate_metrics(
173167
ttfts.append(outputs[i].ttft)
174168
e2els.append(outputs[i].latency)
175169
tput_user.append(output_len / (outputs[i].latency))
176-
177-
# Calculate request accuracy rate (num_generated_tokens / (decode_iteration + 1))
178-
decode_iter = outputs[i].decode_iteration
179-
if decode_iter >= 0:
180-
# For generated tokens, we use output_len - 1 (excluding the first token if needed)
181-
# But according to the reference, it should be num_generated_tokens
182-
num_generated_tokens = max(0, output_len -
183-
1) if output_len > 1 else output_len
184-
request_ar = num_generated_tokens / (
185-
decode_iter + 1) if decode_iter >= 0 else 0.0
186-
request_ars.append(request_ar)
187-
else:
188-
request_ars.append(0.0)
189-
190170
completed += 1
191171
else:
192172
actual_output_lens.append(0)
193-
request_ars.append(0.0)
194173

195174
if goodput_config_dict:
196175
valid_metrics = []
@@ -249,13 +228,8 @@ def calculate_metrics(
249228
percentiles_e2el_ms=[(p, np.percentile(e2els or 0, p) * 1000)
250229
for p in selected_percentiles],
251230
tput_user=np.mean(tput_user or 0),
252-
mean_request_ar=np.mean(request_ars or 0),
253-
median_request_ar=np.median(request_ars or 0),
254-
std_request_ar=np.std(request_ars or 0),
255-
percentiles_request_ar=[(p, np.percentile(request_ars or 0, p))
256-
for p in selected_percentiles],
257231
)
258-
return metrics, actual_output_lens, request_ars
232+
return metrics, actual_output_lens
259233

260234

261235
async def benchmark(
@@ -429,7 +403,7 @@ async def limited_request_func(request_func_input, streaming, pbar,
429403
# Close the session
430404
await session.close()
431405

432-
metrics, actual_output_lens, request_ars = calculate_metrics(
406+
metrics, actual_output_lens = calculate_metrics(
433407
input_requests=input_requests,
434408
outputs=outputs,
435409
dur_s=benchmark_duration,
@@ -457,10 +431,6 @@ async def limited_request_func(request_func_input, streaming, pbar,
457431
metrics.total_token_throughput))
458432
print("{:<40} {:<10.2f}".format("User throughput (tok/s):",
459433
metrics.tput_user))
460-
print("{:<40} {:<10.4f}".format("Mean Request AR:",
461-
metrics.mean_request_ar))
462-
print("{:<40} {:<10.4f}".format("Median Request AR:",
463-
metrics.median_request_ar))
464434

465435
result = {
466436
"duration": benchmark_duration,
@@ -473,17 +443,12 @@ async def limited_request_func(request_func_input, streaming, pbar,
473443
"output_throughput": metrics.output_throughput,
474444
"total_token_throughput": metrics.total_token_throughput,
475445
"user_throughput": metrics.tput_user,
476-
"mean_request_ar": metrics.mean_request_ar,
477-
"median_request_ar": metrics.median_request_ar,
478-
"std_request_ar": metrics.std_request_ar,
479446
"input_lens": [output.prompt_len for output in outputs],
480447
"output_lens": actual_output_lens,
481448
"ttfts": [output.ttft for output in outputs],
482449
"itls": [output.itl for output in outputs],
483450
"generated_texts": [output.generated_text for output in outputs],
484451
"errors": [output.error for output in outputs],
485-
"request_ars": request_ars,
486-
"decode_iterations": [output.decode_iteration for output in outputs],
487452
}
488453

489454
def process_one_metric(
@@ -569,15 +534,11 @@ def save_to_pytorch_benchmark_format(args: argparse.Namespace,
569534
metrics = [
570535
"median_ttft_ms", "mean_ttft_ms", "std_ttft_ms", "p99_ttft_ms",
571536
"mean_tpot_ms", "median_tpot_ms", "std_tpot_ms", "p99_tpot_ms",
572-
"median_itl_ms", "mean_itl_ms", "std_itl_ms", "p99_itl_ms",
573-
"mean_request_ar", "median_request_ar", "std_request_ar"
537+
"median_itl_ms", "mean_itl_ms", "std_itl_ms", "p99_itl_ms"
574538
]
575539
# These raw data might be useful, but they are rather big. They can be added
576540
# later if needed
577-
ignored_metrics = [
578-
"ttfts", "itls", "generated_texts", "errors", "request_ars",
579-
"decode_iterations"
580-
]
541+
ignored_metrics = ["ttfts", "itls", "generated_texts", "errors"]
581542
pt_records = convert_to_pytorch_benchmark_format(
582543
args=args,
583544
metrics={k: [results[k]]
@@ -801,8 +762,7 @@ def main(args: argparse.Namespace):
801762
# Remove fields with too many data points
802763
for field in [
803764
"input_lens", "output_lens", "ttfts", "itls",
804-
"generated_texts", "errors", "request_ars",
805-
"decode_iterations"
765+
"generated_texts", "errors"
806766
]:
807767
if field in result_json:
808768
del result_json[field]
@@ -1003,11 +963,11 @@ def main(args: argparse.Namespace):
1003963
parser.add_argument(
1004964
"--percentile-metrics",
1005965
type=str,
1006-
default="ttft,tpot,itl,request_ar",
966+
default="ttft,tpot,itl",
1007967
help="Comma-separated list of selected metrics to report percentils. "
1008968
"This argument specifies the metrics to report percentiles. "
1009-
"Allowed metric names are \"ttft\", \"tpot\", \"itl\", \"e2el\", \"request_ar\". "
1010-
"Default value is \"ttft,tpot,itl,request_ar\".")
969+
"Allowed metric names are \"ttft\", \"tpot\", \"itl\", \"e2el\". "
970+
"Default value is \"ttft,tpot,itl\".")
1011971
parser.add_argument(
1012972
"--metric-percentiles",
1013973
type=str,

0 commit comments

Comments
 (0)