[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:
142 files changed
+48389
-1013
No files matched your search
@@ -21,6 +21,8 @@ from vllm_omni.data_entry_keys import (
|
||||
)
|
||||
from vllm_omni.engine import AdditionalInformationPayload
|
||||
|
||||
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
|
||||
|
||||
|
||||
class TestOmniPayloadStruct:
|
||||
"""Runtime-validated mirror of OmniPayload (msgspec.Struct)."""
|
||||
@@ -43,6 +45,16 @@ class TestOmniPayloadStruct:
|
||||
with pytest.raises(msgspec.ValidationError, match="unknown field"):
|
||||
to_struct({"meta": {"finisheed": True}})
|
||||
|
||||
def test_to_struct_rejects_minicpmo_duplex_runtime_handoff_fields(self):
|
||||
with pytest.raises(msgspec.ValidationError, match="unknown field"):
|
||||
to_struct({"hidden_states": {"tts": torch.zeros(1)}})
|
||||
with pytest.raises(msgspec.ValidationError, match="unknown field"):
|
||||
to_struct({"ids": {"tts": [1]}})
|
||||
with pytest.raises(msgspec.ValidationError, match="unknown field"):
|
||||
to_struct({"meta": {"ref_audio_sr": 16000}})
|
||||
with pytest.raises(msgspec.ValidationError, match="unknown field"):
|
||||
to_struct({"meta": {"listen_token_id": 151685}})
|
||||
|
||||
def test_to_struct_rejects_wrong_type(self):
|
||||
with pytest.raises(msgspec.ValidationError, match="Expected"):
|
||||
to_struct({"meta": {"left_context_size": "not_an_int"}})
|
||||
@@ -66,10 +78,10 @@ class TestOmniPayloadStruct:
|
||||
|
||||
def test_struct_with_all_categories(self):
|
||||
d = {
|
||||
"hidden_states": {"output": torch.zeros(1)},
|
||||
"hidden_states": {"output": torch.zeros(1), "last": torch.ones(2, 4)},
|
||||
"embed": {"prefill": torch.zeros(1), "tts_bos": torch.zeros(1)},
|
||||
"ids": {"all": [1, 2], "prompt": [1]},
|
||||
"codes": {"audio": torch.zeros(1)},
|
||||
"ids": {"all": [1, 2], "prompt": [1], "speech_token": [3, 4]},
|
||||
"codes": {"audio": torch.zeros(1), "ref": torch.ones(4)},
|
||||
"meta": {"left_context_size": 3, "num_processed_tokens": 7},
|
||||
}
|
||||
s = to_struct(d)
|
||||
@@ -79,7 +91,10 @@ class TestOmniPayloadStruct:
|
||||
assert isinstance(s.codes, CodesStruct)
|
||||
assert isinstance(s.meta, MetaStruct)
|
||||
assert s.ids.all == [1, 2]
|
||||
assert s.ids.speech_token == [3, 4]
|
||||
assert torch.equal(s.hidden_states.last, torch.ones(2, 4))
|
||||
assert s.meta.num_processed_tokens == 7
|
||||
assert torch.equal(s.codes.ref, torch.ones(4))
|
||||
|
||||
|
||||
class TestValidatePayload:
|
||||
@@ -332,7 +347,7 @@ class TestSerializeDeserializePayload:
|
||||
"hidden_states": {"output": torch.tensor([1.0, 2.0])},
|
||||
"ids": {"all": [1, 2, 3]},
|
||||
"meta": {"finished": torch.tensor(False, dtype=torch.bool), "ar_width": 4},
|
||||
"codes": {"audio": torch.tensor([3.0])},
|
||||
"codes": {"audio": torch.tensor([3.0]), "ref": torch.tensor([0.1, 0.2])},
|
||||
}
|
||||
wire = serialize_payload(original)
|
||||
restored = deserialize_payload(wire)
|
||||
@@ -341,6 +356,7 @@ class TestSerializeDeserializePayload:
|
||||
assert restored["meta"]["finished"].item() is False
|
||||
assert restored["meta"]["ar_width"] == 4
|
||||
assert torch.equal(restored["codes"]["audio"], original["codes"]["audio"])
|
||||
assert torch.equal(restored["codes"]["ref"], original["codes"]["ref"])
|
||||
|
||||
def test_hidden_states_layers_round_trip(self):
|
||||
original = {
|
||||
|
||||
Reference in new issue
Block a user