[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
@@ -2,6 +2,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
"""Regression tests for OmniRequestState multimodal DELTA drain and consolidation guard."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
@@ -38,6 +39,21 @@ _DETOK = MagicMock(
|
||||
)
|
||||
_LOGPROBS = MagicMock(logprobs=None, cumulative_logprob=None, prompt_logprobs=None)
|
||||
|
||||
|
||||
@dataclass
|
||||
class _StreamingUpdate:
|
||||
final: bool
|
||||
prompt: object | None
|
||||
prompt_token_ids: list[int]
|
||||
arrival_time: float
|
||||
|
||||
|
||||
@dataclass
|
||||
class _FinishedRequestMetric:
|
||||
request_id: str
|
||||
mean_time_per_output_token: float
|
||||
|
||||
|
||||
_DEFAULT_STATE_KWARGS = dict(
|
||||
request_id="r",
|
||||
external_req_id="r",
|
||||
@@ -130,6 +146,119 @@ def test_native_text_metrics_include_segment_generation_token_count(monkeypatch)
|
||||
assert processor.pop_native_text_metrics("r")["num_generation_tokens"] == 27
|
||||
|
||||
|
||||
def test_native_text_metrics_exclude_cross_segment_gap(monkeypatch):
|
||||
monkeypatch.setattr(VLLMOutputProcessor, "_update_stats_from_output", lambda *args, **kwargs: None)
|
||||
processor = object.__new__(MultimodalOutputProcessor)
|
||||
processor._native_text_metrics_by_request = {}
|
||||
processor.lora_states = {}
|
||||
state = _make_state(RequestOutputKind.DELTA)
|
||||
iteration_stats = MagicMock()
|
||||
|
||||
def update_segment(_output, timestamp, _was_prefilling, native_stats, *_args):
|
||||
native_stats.num_generation_tokens = 2 if timestamp == 10.03 else 1
|
||||
native_stats.first_token_ts = 10.02 if timestamp == 10.03 else timestamp
|
||||
native_stats.last_token_ts = timestamp
|
||||
native_stats.first_token_latency = 0.01
|
||||
|
||||
iteration_stats.update_from_output.side_effect = update_segment
|
||||
processor._update_stats_from_output(
|
||||
state,
|
||||
MagicMock(),
|
||||
10.0,
|
||||
iteration_stats,
|
||||
)
|
||||
first_segment = processor.pop_native_text_metrics("r")
|
||||
assert first_segment["vllm_tpot_ms"] == 0.0
|
||||
assert first_segment["vllm_itls_ms"] == []
|
||||
|
||||
state.apply_streaming_update(
|
||||
_StreamingUpdate(
|
||||
final=False,
|
||||
prompt=None,
|
||||
prompt_token_ids=[],
|
||||
arrival_time=10.01,
|
||||
)
|
||||
)
|
||||
state.is_prefilling = True
|
||||
processor._update_stats_from_output(
|
||||
state,
|
||||
MagicMock(),
|
||||
10.02,
|
||||
iteration_stats,
|
||||
)
|
||||
state.is_prefilling = False
|
||||
processor._update_stats_from_output(
|
||||
state,
|
||||
MagicMock(),
|
||||
10.03,
|
||||
iteration_stats,
|
||||
)
|
||||
second_segment = processor.pop_native_text_metrics("r")
|
||||
|
||||
assert second_segment["num_generation_tokens"] == 2
|
||||
assert second_segment["vllm_itls_ms"] == pytest.approx([10.0])
|
||||
assert second_segment["vllm_tpot_ms"] == pytest.approx(10.0)
|
||||
|
||||
|
||||
def test_native_text_tpot_weights_multi_token_engine_output(monkeypatch):
|
||||
monkeypatch.setattr(VLLMOutputProcessor, "_update_stats_from_output", lambda *args, **kwargs: None)
|
||||
processor = object.__new__(MultimodalOutputProcessor)
|
||||
processor._native_text_metrics_by_request = {}
|
||||
processor.lora_states = {}
|
||||
state = _make_state(RequestOutputKind.DELTA)
|
||||
iteration_stats = MagicMock()
|
||||
|
||||
def update_segment(_output, timestamp, _was_prefilling, native_stats, *_args):
|
||||
native_stats.num_generation_tokens = 1 if timestamp == 10.0 else 4
|
||||
native_stats.first_token_ts = 10.0
|
||||
native_stats.last_token_ts = timestamp
|
||||
native_stats.first_token_latency = 0.01
|
||||
|
||||
iteration_stats.update_from_output.side_effect = update_segment
|
||||
state.is_prefilling = True
|
||||
processor._update_stats_from_output(state, MagicMock(), 10.0, iteration_stats)
|
||||
state.is_prefilling = False
|
||||
processor._update_stats_from_output(state, MagicMock(), 10.03, iteration_stats)
|
||||
record = processor.pop_native_text_metrics("r")
|
||||
|
||||
assert record["num_generation_tokens"] == 4
|
||||
assert record["vllm_itls_ms"] == pytest.approx([30.0])
|
||||
assert record["vllm_itl_ms"] == pytest.approx(30.0)
|
||||
assert record["vllm_tpot_ms"] == pytest.approx(10.0)
|
||||
assert "_tpot_elapsed_ms" not in record
|
||||
assert "_tpot_intervals" not in record
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("finished_tpot_s", "expected_tpot_ms"),
|
||||
[(0.0, 19.0), (0.023, 23.0)],
|
||||
)
|
||||
def test_native_text_tpot_only_accepts_positive_finished_metric(
|
||||
monkeypatch,
|
||||
finished_tpot_s,
|
||||
expected_tpot_ms,
|
||||
):
|
||||
monkeypatch.setattr(VLLMOutputProcessor, "_update_stats_from_finished", lambda *args, **kwargs: None)
|
||||
processor = object.__new__(MultimodalOutputProcessor)
|
||||
processor._native_text_metrics_by_request = {"r": {"vllm_tpot_ms": 19.0}}
|
||||
state = _make_state(RequestOutputKind.DELTA)
|
||||
iteration_stats = MagicMock()
|
||||
iteration_stats.finished_requests = [
|
||||
_FinishedRequestMetric(
|
||||
request_id="r",
|
||||
mean_time_per_output_token=finished_tpot_s,
|
||||
)
|
||||
]
|
||||
|
||||
processor._update_stats_from_finished(
|
||||
state,
|
||||
FinishReason.STOP,
|
||||
iteration_stats,
|
||||
)
|
||||
|
||||
assert processor.pop_native_text_metrics("r")["vllm_tpot_ms"] == expected_tpot_ms
|
||||
|
||||
|
||||
def test_delta_drains_output_modality_per_step():
|
||||
"""DELTA drains the mm_type key (output modality) but preserves hidden-state keys."""
|
||||
s = _make_state(RequestOutputKind.DELTA)
|
||||
|
||||
Reference in new issue
Block a user