[Full Duplex] Feat: Support Full-Duplex realtime runtime & add MiniCPM-o 4.5 demo (#3907)

Signed-off-by: Sy03 <1370724210@qq.com>
Signed-off-by: lishunyang12 <lishunyang03@gmail.com>
Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
Co-authored-by: lishunyang12 <lishunyang03@gmail.com>
Co-authored-by: Yueqian Lin <linyueqian@outlook.com>
Co-authored-by: StormMelody <22371184@zju.edu.cn>
Co-authored-by: Gao Han <hgaoaf@connect.ust.hk>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
authored and GitHub committed 2026-07-23 16:45:18 +08:00
1 parent b55120c93b
commit 05b794f29b
142 files changed
+48389 -1013

No files matched your search

+39 -57
View File
@@ -196,8 +196,7 @@ def _make_runner_for_mimo(req_id="r_mimo"):
def test_talker_mtp_forward_cpu_updates_inputs_and_info(monkeypatch):
# `_talker_mtp_forward` calls `current_omni_platform.set_forward_context`,
# which would otherwise dispatch to the real device implementation.
# `_talker_mtp_forward` dispatches through the active platform.
import vllm_omni.worker.gpu_model_runner as mod # Must be the same module that defines OmniGPUModelRunner
monkeypatch.setattr(mod.current_omni_platform, "set_forward_context", _noop_forward_context)
@@ -459,28 +458,33 @@ def test_update_intermediate_buffer_skips_unknown_req_id():
assert "unknown_req" not in runner.model_intermediate_buffer
def test_maybe_run_batch_preprocess_calls_model_hook():
runner = object.__new__(OmniGPUModelRunner)
runner.model_intermediate_buffer = {"r1": {"text": ["hello"]}}
calls = []
def test_streaming_input_update_merges_model_intermediate_buffer():
runner = _make_runner(req_ids=("r1",), hidden_size=4)
runner.model_intermediate_buffer["r1"] = {
"duplex": {
"session_id": "sid",
"seq": 1,
}
}
runner.requests["r1"].additional_information_cpu = runner.model_intermediate_buffer["r1"]
new_req_data = SimpleNamespace(
model_intermediate_buffer={
"duplex": {
"session_id": "sid",
"seq": 2,
"payload": {"type": "audio"},
}
},
additional_information=None,
)
class DummyModel:
def preprocess_batch(self, *, req_ids, model_intermediate_buffer, device):
calls.append((req_ids, model_intermediate_buffer, device))
OmniGPUModelRunner._update_streaming_input_additional_info(runner, new_req_data, "r1")
runner.model = DummyModel()
OmniGPUModelRunner._maybe_run_batch_preprocess(runner, ["r1"], torch.device("cpu"))
assert calls == [(["r1"], runner.model_intermediate_buffer, torch.device("cpu"))]
def test_maybe_run_batch_preprocess_skips_missing_hook():
runner = object.__new__(OmniGPUModelRunner)
runner.model_intermediate_buffer = {}
runner.model = object()
OmniGPUModelRunner._maybe_run_batch_preprocess(runner, ["r1"], torch.device("cpu"))
info = runner.model_intermediate_buffer["r1"]
assert info["duplex"]["session_id"] == "sid"
assert info["duplex"]["seq"] == 2
assert info["duplex"]["payload"] == {"type": "audio"}
assert runner.requests["r1"].additional_information_cpu is info
def _make_full_payload_accumulation_runner(
@@ -501,8 +505,6 @@ def _make_full_payload_accumulation_runner(
runner._custom_process_func = object()
runner._pending_full_payload_send = {}
runner._stage_id = 1
# Non-None sentinel: the gate short-circuits to False when no connector
# is configured at all (terminal stages in pipelines with no connector).
runner._omni_connector = object()
return runner
@@ -519,7 +521,7 @@ def test_accumulate_full_payload_output_preserves_aligned_all_zero_qwen3_omni_co
def test_accumulate_full_payload_output_keeps_misaligned_all_zero_qwen3_omni_codec_rows():
# After removing the sender-side zero filter, the full-payload accumulator keeps every
# After removing the sender-side zero filter, the accumulator keeps every
# codec row including misaligned all-zero rows. The downstream consumer
# (_extract_qwen3_full_payload_codec_rows) is the authoritative crop and
# filters by output_token_ids.
@@ -566,45 +568,25 @@ def test_accumulate_full_payload_output_keeps_all_zero_qwen3_omni_prefill_placeh
def test_full_payload_output_accumulation_hook_matrix():
"""Producer-side gate: fires iff an explicit next-stage payload hook is loaded.
A derived `*_full_payload` helper from `custom_process_input_func` is not
enough: terminal/input-only consumer stages must not enqueue orphan
downstream payloads.
"""
# Thinker / talker producer stages: explicit next-stage payload hook -> gate fires.
assert _make_full_payload_accumulation_runner(model_stage="thinker")._should_accumulate_full_payload_output()
assert _make_full_payload_accumulation_runner(model_stage="talker")._should_accumulate_full_payload_output()
# Terminal stage: even if _load_custom_func derived a builder from
# custom_process_input_func, final output stages are not producers.
runner = _make_full_payload_accumulation_runner(model_stage="code2wav", final_output=True)
assert not runner._should_accumulate_full_payload_output()
# Input-only consumer stage without an explicit producer hook must not
# accumulate/send just because a same-module *_full_payload helper exists.
runner = _make_full_payload_accumulation_runner(
assert not _make_full_payload_accumulation_runner(
model_stage="code2wav", final_output=True
)._should_accumulate_full_payload_output()
assert not _make_full_payload_accumulation_runner(
model_stage="token2audio",
custom_process_next_stage_input_func=None,
)
assert not runner._should_accumulate_full_payload_output()
# async_chunk mode -> gate off.
)._should_accumulate_full_payload_output()
assert not _make_full_payload_accumulation_runner(
model_stage="talker", async_chunk=True
)._should_accumulate_full_payload_output()
# Non-qwen3 arches: gate is arch-agnostic, but if the fixture's arch
# does not configure a connector payload builder, its runtime
# `_custom_process_func` is None. Emulate that.
runner = _make_full_payload_accumulation_runner(model_arch="Qwen3TTSForConditionalGeneration")
runner._custom_process_func = None
runner._should_accumulate_full_payload_output_cached = None
assert not runner._should_accumulate_full_payload_output()
runner = _make_full_payload_accumulation_runner(model_arch="Qwen2_5OmniForConditionalGeneration")
runner._custom_process_func = None
runner._should_accumulate_full_payload_output_cached = None
assert not runner._should_accumulate_full_payload_output()
for model_arch in (
"Qwen3TTSForConditionalGeneration",
"Qwen2_5OmniForConditionalGeneration",
):
runner = _make_full_payload_accumulation_runner(model_arch=model_arch)
runner._custom_process_func = None
assert not runner._should_accumulate_full_payload_output()
def test_sync_local_stage_payloads_retains_payload_until_request_is_active():