Merge vLLM-Omni v0.29.0rc1 into edge-infer/omni-0.29.0

The pair for vLLM v0.29.0: rc1's docs pin vllm==0.29.0 and a static scan of
rc1's vllm.* imports against the v0.29.0 tree finds nothing missing, while
our 0.28-based tree needs seven modules v0.29.0 no longer has
(vllm.inputs.preprocess, entrypoints.launcher, openai.cli_args,
openai.engine.protocol, serve.utils.server_utils, layers.batch_invariant,
models.hunyuan_v1).

Ten files conflicted. Upstream's structure is the base everywhere; the
fork's features are re-attached to it:
- deploy_profile / apply_deploy_profile run before rc1's resolve_omni_config
  pops deploy_config (async_omni_engine, cli/serve); the deploy-profile
  selector and the resolve_model_config_path chain it needs stay in
  entrypoints/utils.py; stage_overrides takes rc1's dict type.
- config_factory keeps the lazy diffusion output-type import; the diffusion
  registry import in rc1's new config/resolver.py is made lazy for the same
  WP6 reason (TTS path must not load diffusion).
- requirements: our core/media split kept; rc1's transformers>=5.13 floor
  and kernels==0.16.1 applied in core.txt / media.txt.
- TTS: rc1's split_granularity and bounded seed plus our output_mode=
  codec_tokens, _SessionInbox cancel handling and codec DELTA accumulation;
  our private _conditioning_cache_salt is superseded by rc1's public
  tts_adapters/base.py::conditioning_cache_salt.
- stage_runtime: rc1's single ExitStack G2 path (lock released before READY)
  replaces our two-path block, with the four worker_phase names the init
  profiler consumes still emitted; _cpu_placed / host admission kept.

Not yet run against vLLM 0.29.0: the tests listed in the W6 record.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
tzhouamandClaude Fable 5.1 committed 2026-09-18 09:57:20 +08:00
commit 33de5d8629
513 files changed
+35146 -10927

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
import pytest
import torch
from vllm_omni.model_executor.models.moss_tts.modeling_moss_tts_talker import MossTTSLocalTalkerForGeneration
from vllm_omni.worker.gpu_ar_model_runner import _snapshot_tensor_payload_to_cpu_async
pytestmark = [pytest.mark.core_model, pytest.mark.cuda]
def test_async_packed_snapshot_survives_source_reuse():
values = [
torch.arange(12, device="cuda").view(1, 12),
torch.empty((0, 12), device="cuda", dtype=torch.long),
torch.arange(24, device="cuda").view(2, 12),
]
expected = [v.cpu() for v in values]
snapshot = _snapshot_tensor_payload_to_cpu_async(
{"list": values, "tuple": tuple(values)}, copy_stream=torch.cuda.Stream(), pin_memory=True
)
for v in values:
v.fill_(-99)
snapshot.wait()
torch.testing.assert_close(snapshot.payload, {"list": expected, "tuple": tuple(expected)}, rtol=0, atol=0)
@pytest.mark.parametrize("offsets", [[0, 1], [1, 4]])
def test_mtp_preserves_rows_and_snapshot_without_cuda_sync(monkeypatch, offsets):
import vllm_omni.worker.gpu_model_runner as mod
from tests.worker.test_omni_gpu_model_runner import _make_runner, _noop_forward_context
monkeypatch.setattr(mod.current_omni_platform, "set_forward_context", _noop_forward_context)
runner = _make_runner(req_ids=("r1", "r2"), hidden_size=4)
runner.model.gpu_resident_buffer_keys = {("codes", "audio")}
for name in ("talker_mtp_input_ids", "talker_mtp_inputs_embeds", "last_talker_hidden", "text_step"):
buffer = getattr(runner, name)
buffer.gpu = buffer.gpu.to("cuda")
embeds = torch.ones((2, 4), device="cuda")
codes = torch.arange(2, device="cuda").view(2, 1)
runner.talker_mtp = lambda *args, **kwargs: (embeds, codes)
output = torch.full((5, 4), -10.0, device="cuda")
previous = torch.cuda.get_sync_debug_mode()
try:
torch.cuda.set_sync_debug_mode("error")
runner._talker_mtp_forward(["r1", "r2"], output, offsets)
finally:
torch.cuda.set_sync_debug_mode(previous)
expected = torch.full((5, 4), -10.0)
expected[offsets] = 1.0
torch.testing.assert_close(output.cpu(), expected, rtol=0, atol=0)
codes.fill_(999)
assert runner.model_intermediate_buffer["r1"]["codes"]["audio"].item() == 0
assert runner.model_intermediate_buffer["r2"]["codes"]["audio"].item() == 1
def test_mixed_stop_flags_do_not_synchronize_cuda():
model = object.__new__(MossTTSLocalTalkerForGeneration)
torch.nn.Module.__init__(model)
model.n_vq = 12
model.audio_pad_token_id = 1024
valid = torch.arange(12, device="cuda").view(1, 12)
stopped = torch.full_like(valid, 1024)
infos = [{"audio_codes": {"current": valid}}, {}, {"audio_codes": {"current": stopped}}]
hidden = torch.ones((3, 4), device="cuda")
previous = torch.cuda.get_sync_debug_mode()
try:
torch.cuda.set_sync_debug_mode("error")
output = model.make_omni_output(hidden, runtime_additional_information=infos)
finally:
torch.cuda.set_sync_debug_mode(previous)
assert model._batch_should_continue.tolist() == [True, True, False]
torch.testing.assert_close(output.multimodal_outputs["codes"]["audio"], [valid, valid[:0], stopped])
assert all("current" not in info.get("audio_codes", {}) for info in infos)
prefill = model.make_omni_output(hidden[:1], runtime_additional_information=[{}])
assert model._batch_should_continue is None and prefill.multimodal_outputs == {}
+1
View File
@@ -1829,6 +1829,7 @@ class TestPreferModelSamplerNoneFallback:
if _declares_prefer_model_sampler(p.read_text(encoding="utf-8", errors="ignore"))
}
expected = {
"audio8_tts",
"cosyvoice3",
"glm_tts",
"higgs_audio_v2",
+59 -7
View File
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
"""Unit tests for OmniConnectorModelRunnerMixin.
These tests use a mock connector (in-memory dict store) and do not require
@@ -376,6 +376,19 @@ class TestFinishedLoadReqsDrain(unittest.TestCase):
class TestLoadCustomFuncSelection(unittest.TestCase):
def test_uses_validator_override_from_public_mixin(self):
config = SimpleNamespace(
async_chunk=True,
custom_process_next_stage_input_func=f"{__name__}._make_request",
)
with patch.object(MixinHost, "_is_connector_payload_builder", return_value=False) as validator:
selected_path, func = MixinHost._load_custom_func(config)
validator.assert_called_once_with(_make_request)
assert selected_path is None
assert func is None
def test_skips_non_payload_stage_input_processors_for_full_payload_mode(self):
incompatible_paths = [
"vllm_omni.model_executor.stage_input_processors.mimo_audio.llm2code2wav",
@@ -861,7 +874,7 @@ class TestLocalPayloadCacheLifecycle(unittest.TestCase):
host._omni_connector.get.return_value = connector_result
tp_group = _FakeTPGroup(world_size=2, rank_in_group=0)
with patch("vllm_omni.worker.omni_connector_model_runner_mixin.get_tp_group", return_value=tp_group):
with patch.object(host, "_get_local_tp_group", return_value=tp_group):
made_progress = host._poll_single_request("r1")
self.assertTrue(made_progress)
@@ -882,7 +895,7 @@ class TestLocalPayloadCacheLifecycle(unittest.TestCase):
host._get_req_chunk["r1"] = 0
tp_group = _FakeTPGroup(world_size=2, rank_in_group=1)
with patch("vllm_omni.worker.omni_connector_model_runner_mixin.get_tp_group", return_value=tp_group):
with patch.object(host, "_get_local_tp_group", return_value=tp_group):
made_progress = host._poll_single_request("r1")
self.assertFalse(made_progress)
@@ -900,7 +913,7 @@ class TestLocalPayloadCacheLifecycle(unittest.TestCase):
payload = {"tok": [10], "finished": torch.tensor(True)}
tp_group = _FakeTPGroup(world_size=2, rank_in_group=1, follower_result={"r1": payload})
with patch("vllm_omni.worker.omni_connector_model_runner_mixin.get_tp_group", return_value=tp_group):
with patch.object(host, "_get_local_tp_group", return_value=tp_group):
results = host.recv_full_payload_inputs(scheduler_output=None)
self.assertEqual(results, {"r1": payload})
@@ -936,7 +949,7 @@ class TestTPAsyncChunkFanout(unittest.TestCase):
host._omni_connector.get.return_value = (payload, 123)
tp_group = _FakeTPGroup(world_size=2, rank_in_group=0)
with patch("vllm_omni.worker.omni_connector_model_runner_mixin.get_tp_group", return_value=tp_group):
with patch.object(host, "_get_local_tp_group", return_value=tp_group):
made_progress = host._poll_single_request("r1")
self.assertTrue(made_progress)
@@ -951,7 +964,7 @@ class TestTPAsyncChunkFanout(unittest.TestCase):
host = self._make_host(rank=1)
tp_group = _FakeTPGroup(world_size=2, rank_in_group=1)
with patch("vllm_omni.worker.omni_connector_model_runner_mixin.get_tp_group", return_value=tp_group):
with patch.object(host, "_get_local_tp_group", return_value=tp_group):
made_progress = host._poll_single_request("r1")
self.assertFalse(made_progress)
@@ -976,7 +989,7 @@ class TestTPAsyncChunkFanout(unittest.TestCase):
}
tp_group = _FakeTPGroup(world_size=2, rank_in_group=1, follower_result=packet)
with patch("vllm_omni.worker.omni_connector_model_runner_mixin.get_tp_group", return_value=tp_group):
with patch.object(host, "_get_local_tp_group", return_value=tp_group):
output = host.get_omni_connector_output()
self.assertEqual(output.chunk_ready_req_ids, {"r1"})
@@ -1049,6 +1062,45 @@ class TestKVTransferLifecycle(unittest.TestCase):
class TestAsyncPayloadLifecycle(unittest.TestCase):
"""Regression tests for async payload delivery lifecycle."""
def test_accumulate_payload_concatenates_chunks(self):
host = MixinHost()
host._send_side_request_payload = {}
first = host._accumulate_payload(
"r1",
{
"embed": {"decode": torch.tensor([[1.0, 2.0]])},
"ids": {"output": [1]},
"meta": {"finished": False},
},
)
merged = host._accumulate_payload(
"r1",
{
"embed": {"decode": torch.tensor([[3.0, 4.0], [5.0, 6.0]])},
"ids": {"output": [2, 3]},
"meta": {"finished": True},
},
)
torch.testing.assert_close(merged["embed"]["decode"], torch.tensor([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]))
self.assertEqual(merged["ids"]["output"], [1, 2, 3])
self.assertIs(merged["meta"]["finished"], True)
self.assertEqual(first["embed"]["decode"].shape, (1, 2))
self.assertEqual(first["ids"]["output"], [1])
self.assertIs(first["meta"]["finished"], False)
def test_accumulate_payload_replaces_override_keys(self):
host = MixinHost()
host._send_side_request_payload = {}
host._accumulate_payload("r1", {"embed": {"decode": torch.ones(2, 2)}, "ids": {"output": [1, 2]}})
payload = {
"embed": {"decode": torch.zeros(1, 2)},
"ids": {"output": [3]},
"meta": {"override_keys": [["embed", "decode"], ["ids", "output"]]},
}
merged = host._accumulate_payload("r1", payload)
torch.testing.assert_close(merged["embed"]["decode"], payload["embed"]["decode"])
self.assertEqual(merged["ids"]["output"], [3])
def test_send_side_request_payload_not_cleared_before_payload_is_consumable(self):
host = MixinHost()
host.init_omni_connectors(
-166
View File
@@ -1,166 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Characterization tests for ``vllm_omni.worker.payload_span``.
These pin the CURRENT behaviour of the thinker-decode span helpers so the later
worker refactors that touch span
plumbing have a regression net. Pure CPU — no model, no CUDA.
"""
import pytest
import torch
from vllm_omni.worker.payload_span import (
get_tensor_span,
get_tensor_span_row,
merge_tensor_spans,
)
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
def _rows(n: int, *, start_val: int = 0, hidden: int = 1) -> torch.Tensor:
"""A ``[n, hidden]`` tensor whose first column counts up from ``start_val``.
``[n, hidden]`` mirrors the connector async-chunk shape (tokens x hidden).
"""
base = torch.arange(start_val, start_val + n, dtype=torch.float32).unsqueeze(1)
return base.repeat(1, hidden)
# --------------------------------------------------------------------------- #
# get_tensor_span #
# --------------------------------------------------------------------------- #
def test_get_tensor_span_valid_returns_triplet():
tensor = _rows(3, hidden=4)
payload = {"emb": tensor, "start": 5, "end": 8}
span = get_tensor_span(payload, tensor_key="emb", start_key="start", end_key="end")
assert span is not None
got_tensor, start, end = span
assert got_tensor is tensor
assert (start, end) == (5, 8)
def test_get_tensor_span_non_tensor_returns_none():
payload = {"emb": None, "start": 0, "end": 0}
assert get_tensor_span(payload, tensor_key="emb", start_key="start", end_key="end") is None
def test_get_tensor_span_non_int_bounds_returns_none():
tensor = _rows(2)
# start is a float, not an int -> rejected.
payload = {"emb": tensor, "start": 0.0, "end": 2}
assert get_tensor_span(payload, tensor_key="emb", start_key="start", end_key="end") is None
def test_get_tensor_span_negative_start_returns_none():
tensor = _rows(1)
payload = {"emb": tensor, "start": -1, "end": 0}
assert get_tensor_span(payload, tensor_key="emb", start_key="start", end_key="end") is None
def test_get_tensor_span_end_before_start_returns_none():
tensor = _rows(2)
payload = {"emb": tensor, "start": 5, "end": 3}
assert get_tensor_span(payload, tensor_key="emb", start_key="start", end_key="end") is None
def test_get_tensor_span_length_mismatch_returns_none():
tensor = _rows(3) # tensor.shape[0] == 3
payload = {"emb": tensor, "start": 0, "end": 2} # end - start == 2
assert get_tensor_span(payload, tensor_key="emb", start_key="start", end_key="end") is None
# --------------------------------------------------------------------------- #
# merge_tensor_spans #
# --------------------------------------------------------------------------- #
def test_merge_none_operand_returns_none():
span = (_rows(2), 0, 2)
assert merge_tensor_spans(None, span) is None
assert merge_tensor_spans(span, None) is None
def test_merge_adjacent_spans_concatenates():
existing = (_rows(3, start_val=0), 0, 3)
incoming = (_rows(2, start_val=3), 3, 5)
merged = merge_tensor_spans(existing, incoming)
assert merged is not None
tensor, start, end = merged
assert (start, end) == (0, 5)
assert tensor.shape[0] == 5
assert tensor[:, 0].tolist() == [0.0, 1.0, 2.0, 3.0, 4.0]
def test_merge_overlapping_spans_trims_incoming():
# existing covers [0, 3); incoming covers [2, 5) -> 1 row of overlap.
existing = (_rows(3, start_val=0), 0, 3)
incoming = (_rows(3, start_val=100), 2, 5)
merged = merge_tensor_spans(existing, incoming)
assert merged is not None
tensor, start, end = merged
assert (start, end) == (0, 5)
# First 3 rows from existing, then incoming's tail (overlap=1 row trimmed).
assert tensor[:, 0].tolist() == [0.0, 1.0, 2.0, 101.0, 102.0]
def test_merge_fully_overlapping_incoming_keeps_existing():
# incoming [1, 3) is fully covered by existing [0, 3): overlap >= incoming len.
existing = (_rows(3, start_val=0), 0, 3)
incoming = (_rows(2, start_val=100), 1, 3)
merged = merge_tensor_spans(existing, incoming)
assert merged is not None
tensor, start, end = merged
assert (start, end) == (0, 3)
assert tensor is existing[0] # returned unchanged
def test_merge_non_contiguous_spans_returns_none():
# gap between existing end (3) and incoming start (5).
existing = (_rows(3, start_val=0), 0, 3)
incoming = (_rows(2, start_val=100), 5, 7)
assert merge_tensor_spans(existing, incoming) is None
def test_merge_casts_incoming_to_existing_dtype_and_device():
existing = (_rows(2, start_val=0).to(torch.float32), 0, 2)
incoming = (torch.arange(2, 4, dtype=torch.int64).unsqueeze(1), 2, 4)
merged = merge_tensor_spans(existing, incoming)
assert merged is not None
tensor, _, _ = merged
assert tensor.dtype == torch.float32
assert tensor.device == existing[0].device
# --------------------------------------------------------------------------- #
# get_tensor_span_row #
# --------------------------------------------------------------------------- #
def test_get_tensor_span_row_in_range():
span = (_rows(3, start_val=10), 5, 8) # rows map to indices 5, 6, 7
row = get_tensor_span_row(span, 6)
assert row is not None
assert row[0].item() == 11.0 # second row (start_val 10 + 1)
def test_get_tensor_span_row_none_span_returns_none():
assert get_tensor_span_row(None, 0) is None
def test_get_tensor_span_row_below_start_returns_none():
span = (_rows(3), 5, 8)
assert get_tensor_span_row(span, 4) is None
def test_get_tensor_span_row_at_or_above_end_returns_none():
span = (_rows(3), 5, 8)
assert get_tensor_span_row(span, 8) is None