[Frontend][Benchmark] Add duplex performance metrics for OmniInteract and Omni-DuplexEval benchmark (#7242)
This commit is contained in:
1 parent
27f0e8c1ea
commit
f062124ba4
21 files changed
+1484
-161
No files matched your search
@@ -150,16 +150,16 @@ def test_unmeasured_duplex_latency_does_not_add_zero_samples():
|
||||
measured.audio_ttfp = 0.2
|
||||
measured.audio_rtf = 0.5
|
||||
measured.duplex_session_metrics = {
|
||||
"mean_ttft_ms": 100.0,
|
||||
"mean_ttfp_ms": 200.0,
|
||||
"mean_rtf": 0.5,
|
||||
"ttft_ms": 100.0,
|
||||
"ttfp_ms": 200.0,
|
||||
"rtf": 0.5,
|
||||
}
|
||||
listen_only = _make_output(100, output_tokens=0)
|
||||
listen_only.ttft = listen_only.audio_ttfp = listen_only.audio_rtf = 0.0
|
||||
listen_only.duplex_session_metrics = {
|
||||
"mean_ttft_ms": None,
|
||||
"mean_ttfp_ms": None,
|
||||
"mean_rtf": None,
|
||||
"ttft_ms": None,
|
||||
"ttfp_ms": None,
|
||||
"rtf": None,
|
||||
}
|
||||
|
||||
metrics = _calculate_test_metrics([measured, listen_only], {"ttft": 150.0})
|
||||
@@ -174,9 +174,9 @@ def test_unmeasured_duplex_latency_does_not_add_zero_samples():
|
||||
def test_all_unmeasured_duplex_latency_is_not_reported_as_zero():
|
||||
listen_only = _make_output(100, output_tokens=0)
|
||||
listen_only.duplex_session_metrics = {
|
||||
"mean_ttft_ms": None,
|
||||
"mean_ttfp_ms": None,
|
||||
"mean_rtf": None,
|
||||
"ttft_ms": None,
|
||||
"ttfp_ms": None,
|
||||
"rtf": None,
|
||||
}
|
||||
|
||||
metrics = _calculate_test_metrics(
|
||||
@@ -196,13 +196,13 @@ def test_unmeasured_duplex_tpot_does_not_add_zero_or_misalign_goodput():
|
||||
missing_tpot.itl = []
|
||||
missing_tpot.text_latency = missing_tpot.ttft = 0.1
|
||||
missing_tpot.tpot_measured = False
|
||||
missing_tpot.duplex_session_metrics = {"mean_ttft_ms": 100.0}
|
||||
missing_tpot.duplex_session_metrics = {"ttft_ms": 100.0}
|
||||
|
||||
slow_ttft = _make_output(100, output_tokens=5)
|
||||
slow_ttft.ttft = 1.0
|
||||
slow_ttft.text_latency = 1.4
|
||||
slow_ttft.itl = [0.1] * 4
|
||||
slow_ttft.duplex_session_metrics = {"mean_ttft_ms": 1000.0}
|
||||
slow_ttft.duplex_session_metrics = {"ttft_ms": 1000.0}
|
||||
|
||||
metrics = _calculate_test_metrics(
|
||||
[missing_tpot, slow_ttft],
|
||||
@@ -219,7 +219,7 @@ def test_all_unmeasured_duplex_token_timing_is_not_reported_as_zero():
|
||||
output.itl = []
|
||||
output.text_latency = output.ttft
|
||||
output.tpot_measured = False
|
||||
output.duplex_session_metrics = {"mean_ttft_ms": 100.0}
|
||||
output.duplex_session_metrics = {"ttft_ms": 100.0}
|
||||
|
||||
metrics = _calculate_test_metrics([output], {"tpot": float("inf")})
|
||||
|
||||
@@ -236,7 +236,7 @@ def test_duplex_response_timings_do_not_build_a_session_token_timeline():
|
||||
{"response_id": "r1", "stage0_tokens": {"itls_ms": [100.0, 100.0]}},
|
||||
{"response_id": "r2", "stage0_tokens": {"itls_ms": [100.0, 100.0]}},
|
||||
]
|
||||
output.duplex_session_metrics = {"mean_ttft_ms": 100.0}
|
||||
output.duplex_session_metrics = {"ttft_ms": 100.0}
|
||||
|
||||
metrics = _calculate_test_metrics([output])
|
||||
|
||||
@@ -252,7 +252,7 @@ def test_unmeasured_tpot_stays_missing_after_tokenizer_fallback():
|
||||
output.itl = []
|
||||
output.text_latency = output.ttft
|
||||
output.tpot_measured = False
|
||||
output.duplex_session_metrics = {"mean_ttft_ms": 100.0}
|
||||
output.duplex_session_metrics = {"ttft_ms": 100.0}
|
||||
|
||||
def tokenizer(text, *, add_special_tokens):
|
||||
assert text == output.generated_text
|
||||
@@ -282,7 +282,7 @@ def test_unmeasured_tpot_stays_missing_after_tokenizer_fallback():
|
||||
def test_zero_itl_does_not_create_zero_tpot():
|
||||
output = _make_output(100, output_tokens=3)
|
||||
output.itl = [0.0, 0.0]
|
||||
output.duplex_session_metrics = {"mean_ttft_ms": 100.0}
|
||||
output.duplex_session_metrics = {"ttft_ms": 100.0}
|
||||
|
||||
metrics = _calculate_test_metrics([output], {"tpot": 1.0})
|
||||
|
||||
@@ -357,9 +357,9 @@ def test_single_token_responses_do_not_report_zero_tpot(capsys):
|
||||
def test_duplex_goodput_does_not_pair_measurements_from_different_requests():
|
||||
text_only, audio_only = _make_output(100), _make_output(100)
|
||||
text_only.ttft, text_only.audio_ttfp = 0.1, 0.0
|
||||
text_only.duplex_session_metrics = {"mean_ttft_ms": 100.0, "mean_ttfp_ms": None, "mean_rtf": None}
|
||||
text_only.duplex_session_metrics = {"ttft_ms": 100.0, "ttfp_ms": None, "rtf": None}
|
||||
audio_only.ttft, audio_only.audio_ttfp = 0.0, 0.2
|
||||
audio_only.duplex_session_metrics = {"mean_ttft_ms": None, "mean_ttfp_ms": 200.0, "mean_rtf": None}
|
||||
audio_only.duplex_session_metrics = {"ttft_ms": None, "ttfp_ms": 200.0, "rtf": None}
|
||||
|
||||
metrics = _calculate_test_metrics([text_only, audio_only], {"ttft": 500.0, "audio_ttft": 500.0})
|
||||
|
||||
|
||||
@@ -287,20 +287,25 @@ async def test_seed_tts_realtime_duplex_exports_per_request_metrics(monkeypatch)
|
||||
"ttft": "conversation.item.create client send to first non-empty text delta",
|
||||
"ttfp": "conversation.item.create client send to first audio packet",
|
||||
"rtf": "request-start-to-last-audio receive time divided by emitted audio duration",
|
||||
"tpot": "Stage-0 engine mean time per output token",
|
||||
},
|
||||
"ttft_ms": pytest.approx(20.0, abs=2.0),
|
||||
"tpot_ms": 10.0,
|
||||
"ttfp_ms": pytest.approx(30.0, abs=2.0),
|
||||
"rtf": pytest.approx(0.3, abs=0.03),
|
||||
"audio_generation_ms": pytest.approx(30.0, abs=2.0),
|
||||
"audio_duration_ms": 100.0,
|
||||
}
|
||||
assert output.duplex_session_metrics == {
|
||||
"session_id": session_id,
|
||||
"audio_turn_count": 4,
|
||||
"mean_ttft_ms": pytest.approx(20.0, abs=2.0),
|
||||
"mean_ttfp_ms": pytest.approx(30.0, abs=2.0),
|
||||
"mean_rtf": pytest.approx(0.3, abs=0.03),
|
||||
}
|
||||
session = output.duplex_session_metrics
|
||||
assert session["session_id"] == session_id
|
||||
assert session["audio_turn_count"] == 4
|
||||
assert session["ttft_ms"]["count"] == 4
|
||||
assert session["ttft_ms"]["mean"] == pytest.approx(20.0, abs=2.0)
|
||||
assert session["tpot_ms"] == {"count": 4, "mean": 10.0, "p50": 10.0, "p99": 10.0}
|
||||
assert session["ttfp_ms"]["count"] == 4
|
||||
assert session["ttfp_ms"]["mean"] == pytest.approx(30.0, abs=2.0)
|
||||
assert session["rtf"]["count"] == 4
|
||||
assert session["rtf"]["mean"] == pytest.approx(0.3, abs=0.03)
|
||||
|
||||
|
||||
def test_stage0_token_timings_use_weighted_tpot_when_itls_are_incomplete():
|
||||
|
||||
@@ -148,6 +148,72 @@ def _successful_output(
|
||||
return case, collector, result
|
||||
|
||||
|
||||
def test_response_metrics_include_engine_tpot_and_stream_window():
|
||||
first_audio = _audio("r1")
|
||||
first_audio["metadata"] = {
|
||||
"audio_duration_ms": 100,
|
||||
"vllm_omni": {
|
||||
"stage_metrics": {
|
||||
"0": {
|
||||
"num_tokens_out": 3,
|
||||
"vllm_tpot_ms": 10.0,
|
||||
"vllm_itls_ms": [10.0, 10.0],
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
second_audio = _audio("r2")
|
||||
second_audio["metadata"] = {
|
||||
"audio_duration_ms": 200,
|
||||
"vllm_omni": {
|
||||
"stage_metrics": {
|
||||
"0": {
|
||||
"num_tokens_out": 2,
|
||||
"vllm_tpot_ms": 20.0,
|
||||
"vllm_itls_ms": [20.0],
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
collector = _collector(
|
||||
(_created("r1"), 10.1),
|
||||
(_text("r1", "first"), 10.2),
|
||||
(first_audio, 10.3),
|
||||
(_done("r1"), 10.4),
|
||||
(_created("r2"), 12.1),
|
||||
(_text("r2", "second"), 12.2),
|
||||
(second_audio, 12.5),
|
||||
(_done("r2"), 12.6),
|
||||
)
|
||||
result = oi.OmniInteractCaseResult("1q1a", "video.mp4", "", session_id="session")
|
||||
|
||||
oi._populate_response_metrics(result, collector, stream_start=10.0)
|
||||
|
||||
assert result.output_tokens == 5
|
||||
assert [metric["tpot_ms"] for metric in result.duplex_request_metrics] == [10.0, 20.0]
|
||||
assert result.duplex_session_metrics == {
|
||||
"session_id": "session",
|
||||
"audio_turn_count": 2,
|
||||
"ttft_ms": {"count": 2, "mean": 100.0, "p50": 100.0, "p99": 100.0},
|
||||
"tpot_ms": {"count": 2, "mean": 15.0, "p50": 10.0, "p99": 20.0},
|
||||
"ttfp_ms": {"count": 2, "mean": 300.0, "p50": 200.0, "p99": 400.0},
|
||||
"rtf": {"count": 2, "mean": 2.0, "p50": 2.0, "p99": 2.0},
|
||||
"stream_ttft_ms": 200.0,
|
||||
"stream_ttfp_ms": 300.0,
|
||||
"stream_rtf": 8.333333,
|
||||
"stream_audio_generation_ms": 2500.0,
|
||||
"stream_audio_duration_ms": 300.0,
|
||||
"stream_measurement_origin": {
|
||||
"ttft": "input stream start to first non-empty text delta",
|
||||
"ttfp": "input stream start to first audio packet",
|
||||
"rtf": (
|
||||
"input stream start-to-last-audio receive time divided by total emitted audio duration; "
|
||||
"includes concurrent realtime input"
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _write_success(
|
||||
root: Path,
|
||||
case: data.OmniInteractCase,
|
||||
@@ -645,7 +711,7 @@ async def test_adapter_requires_and_forwards_exact_prepared_payload(tmp_path: Pa
|
||||
transcript="timing metadata missing",
|
||||
output_tokens=0,
|
||||
duplex_request_metrics=[{"request_metrics": {"ttft_ms": 1.0}}],
|
||||
duplex_session_metrics={"mean_ttft_ms": 10.0},
|
||||
duplex_session_metrics={"ttft_ms": 10.0},
|
||||
)
|
||||
|
||||
monkeypatch.setattr(benchmark_patch, "run_omniinteract_case", run)
|
||||
@@ -713,7 +779,7 @@ async def test_adapter_reports_exact_or_weighted_token_timing(
|
||||
success=True,
|
||||
output_tokens=5,
|
||||
duplex_request_metrics=request_metrics,
|
||||
duplex_session_metrics={"mean_ttft_ms": 100.0},
|
||||
duplex_session_metrics={"ttft_ms": 100.0},
|
||||
)
|
||||
|
||||
monkeypatch.setattr(benchmark_patch, "run_omniinteract_case", run)
|
||||
|
||||
Reference in new issue
Block a user