Dev/rebase v0170 (#1639)

Signed-off-by: Taichang Zhou <tzhouam@connect.ust.hk>
Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
Signed-off-by: princepride <wangzhipeng628@gmail.com>
Signed-off-by: Zhou Taichang <tzhouam@connect.ust.hk>
Co-authored-by: 汪志鹏 <wangzhipeng628@gmail.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-03-09 17:29:38 +08:00
1 parent 4db10d6dec
commit 89b527e533
38 files changed
+828 -365

No files matched your search

@@ -414,7 +414,8 @@ def ulysses_attention_on_test_model(
# Generate and save full input data with fixed seed
# Reinitialize RNG to ensure reproducibility
torch.manual_seed(42)
current_omni_platform.seed_everything(42)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(42)
full_hidden_states = torch.randn(
(batch_size, seq_len, hidden_size),
dtype=dtype,
@@ -66,14 +66,13 @@ def shm_connector():
def test_put_get_inline(shm_connector):
"""Test inline transfer for small data."""
"""Test transfer for small data (currently always uses SHM)."""
data = {"small": "data"}
# Ensure data is smaller than threshold (100 bytes)
success, size, metadata = shm_connector.put("stage_0", "stage_1", "req_1", data)
assert success is True
assert "inline_bytes" in metadata
assert "shm" not in metadata
assert "shm" in metadata
assert "size" in metadata
# Retrieve
retrieved_data, ret_size = shm_connector.get("stage_0", "stage_1", "req_1", metadata)
@@ -87,7 +86,7 @@ def test_put_get_shm(mocker: MockerFixture, shm_connector, monkeypatch: pytest.M
data = {"large": "x" * 200}
# Mock SHM return values
mock_handle = {"name": "test_shm", "size": 200}
mock_handle = {"name": "req_2", "size": 200}
mock_write = mocker.MagicMock(return_value=mock_handle)
monkeypatch.setattr("vllm_omni.distributed.omni_connectors.connectors.shm_connector.shm_write_bytes", mock_write)
+2 -2
View File
@@ -28,7 +28,7 @@ def get_stage_config(name: str = "qwen3_tts.yaml"):
return str(Path(__file__).parent.parent.parent.parent / "vllm_omni" / "model_executor" / "stage_configs" / name)
@pytest.fixture(scope="module")
@pytest.fixture(scope="class")
def omni_server():
"""Start vLLM-Omni server with CustomVoice model."""
stage_config_path = get_stage_config()
@@ -225,7 +225,7 @@ class TestQwen3TTSAPIEndpoints:
assert len(data["data"]) > 0
@pytest.fixture(scope="module")
@pytest.fixture(scope="class")
def omni_server_no_async_chunk():
"""Start vLLM-Omni server with non-async-chunk config."""
stage_config_path = get_stage_config("qwen3_tts_no_async_chunk.yaml")
+3 -2
View File
@@ -74,12 +74,13 @@ stage_args:
model_arch: Qwen2_5OmniForConditionalGeneration
worker_type: generation
scheduler_cls: vllm_omni.core.sched.omni_generation_scheduler.OmniGenerationScheduler
gpu_memory_utilization: 0.15
gpu_memory_utilization: 0.9 #increase the gpu memory utilization to enable the test on H800
enforce_eager: true
trust_remote_code: true
enable_prefix_caching: false
engine_output_type: audio
max_num_batched_tokens: 100000
max_num_batched_tokens: 4096
max_model_len: 4096
engine_input_source: [1]
final_output: true
final_output_type: audio
+1 -1
View File
@@ -48,7 +48,7 @@ stage_args:
model_arch: Qwen3OmniMoeForConditionalGeneration
worker_type: ar
scheduler_cls: vllm_omni.core.sched.omni_ar_scheduler.OmniARScheduler
gpu_memory_utilization: 0.6
gpu_memory_utilization: 0.5
enforce_eager: false
trust_remote_code: true
engine_output_type: latent # Output codec codes for code2wav
+70
View File
@@ -1,3 +1,4 @@
import inspect
import uuid
import warnings
from queue import Empty, Queue
@@ -1194,3 +1195,72 @@ def test_close_sends_shutdown_signal(monkeypatch: pytest.MonkeyPatch, mocker: Mo
# Verify stop_stage_worker was called (process should be set)
assert omni.stage_list[0]._proc is not None
# ---------------------------------------------------------------------------
# Signature compatibility tests — catch upstream API drift early
# ---------------------------------------------------------------------------
_INHERITANCE_PAIRS: list[tuple[str, str, str, str]] = [
(
"vllm.entrypoints.llm",
"LLM",
"vllm_omni.entrypoints.omni_llm",
"OmniLLM",
),
]
def _import_class(module_path: str, class_name: str):
mod = __import__(module_path, fromlist=[class_name])
return getattr(mod, class_name)
@pytest.mark.parametrize(
"up_mod,up_cls,omni_mod,omni_cls",
_INHERITANCE_PAIRS,
ids=[f"{pair[3]}({pair[1]})" for pair in _INHERITANCE_PAIRS],
)
def test_overridden_method_signatures_compatible(up_mod: str, up_cls: str, omni_mod: str, omni_cls: str):
"""All params accepted by a base-class method must also be accepted by
the overriding method in the vllm-omni subclass. This prevents
TypeError at runtime when upstream callers pass new arguments."""
BaseCls = _import_class(up_mod, up_cls)
OmniCls = _import_class(omni_mod, omni_cls)
failures: list[str] = []
for name in dir(OmniCls):
if name.startswith("__") and name != "__init__":
continue
omni_method = getattr(OmniCls, name, None)
base_method = getattr(BaseCls, name, None)
if not (callable(omni_method) and callable(base_method)):
continue
if omni_method is base_method:
continue
try:
base_sig = inspect.signature(base_method)
omni_sig = inspect.signature(omni_method)
except (ValueError, TypeError):
continue
omni_has_var_keyword = any(p.kind == inspect.Parameter.VAR_KEYWORD for p in omni_sig.parameters.values())
base_params = base_sig.parameters
omni_params = set(omni_sig.parameters.keys())
missing = []
for pname, param in base_params.items():
if pname in omni_params:
continue
if omni_has_var_keyword and param.kind in (
inspect.Parameter.KEYWORD_ONLY,
inspect.Parameter.POSITIONAL_OR_KEYWORD,
):
continue
missing.append(pname)
if missing:
failures.append(f"{omni_cls}.{name}() missing params {sorted(missing)}; base={base_sig}, omni={omni_sig}")
assert not failures, f"Signature mismatches found ({len(failures)}):\n" + "\n".join(f" - {f}" for f in failures)
+1 -1
View File
@@ -85,7 +85,7 @@ stage_args:
engine_output_type: audio # Final output: audio waveform
gpu_memory_utilization: 0.1
distributed_executor_backend: "mp"
max_num_batched_tokens: 1000000
max_num_batched_tokens: 100000
hf_config_name: thinker_config
engine_input_source: [1]
custom_process_input_func: vllm_omni.model_executor.stage_input_processors.qwen3_omni.talker2code2wav
@@ -34,6 +34,7 @@ def _make_runner(multimodal_outputs):
runner.use_async_scheduling = False
runner.device = torch.device("cpu")
runner.supports_mm_inputs = False
runner.speculative_config = None
return runner