[MR V2] Migrate to Model Runner V2
Squashed migration rebased onto current main. Collapses the 46-commit dev/migrate-MR-v2 history (10 merge commits + superseded pre-rebase work) into a single commit, so the diff reflects only the genuine MR-V2 feature (worker_v2/ runners + model_states, omni schedulers, stage engine pipeline, pooling_output serialization bridge). Content already merged to main separately (step_audio2, tts_adapters, npu/_310p, etc.) drops out. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
cead615288
commit
9678ae58cf
74 files changed
+8244
-95
No files matched your search
@@ -121,6 +121,13 @@ class OmniEngineCoreOutput(EngineCoreOutput):
|
||||
# pooling_output is inherited from EngineCoreOutput as torch.Tensor | None
|
||||
# and retains its original vLLM semantics for pooling/embedding tasks.
|
||||
multimodal_output: dict[str, torch.Tensor] | None = None
|
||||
# Bytes-serialized carrier for a dict-shaped pooling_output (MR V2 cross-stage
|
||||
# hidden/codec handoff). vLLM 0.23 strictly decodes ``pooling_output`` as a
|
||||
# ``torch.Tensor``, so a per-request dict payload cannot ride that field. The
|
||||
# producer (OmniARScheduler) sets ``pooling_output=None`` and serializes the
|
||||
# dict here; the consumer (StagePool._poll_stage_raw) rehydrates it back into
|
||||
# ``pooling_output`` after decode. Tensor pooling outputs are unaffected.
|
||||
pooling_output_payload: AdditionalInformationPayload | None = None
|
||||
# Finished flag for streaming input segment
|
||||
is_segment_finished: bool | None = False
|
||||
# Streaming update prompt length
|
||||
|
||||
@@ -1532,6 +1532,28 @@ class AsyncOmniEngine:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ── Release CuMem allocator memory pool ──────────────────────────────
|
||||
# When enable_sleep_mode is in use, the CuMem (CUDA Virtual Memory
|
||||
# Management) allocator holds model weights in a singleton memory pool
|
||||
# that lives in the parent process. Killing the engine-core subprocess
|
||||
# does NOT release this pool — the weights stay resident on the GPU
|
||||
# and can cause CUDA OOM for subsequent engine instances (especially
|
||||
# large models like BAGEL-7B-MoT whose weights alone consume ~134 GiB).
|
||||
#
|
||||
# Discard mode (level=2) is correct at shutdown: there is no benefit to
|
||||
# keeping a CPU backup when the engine is being torn down.
|
||||
try:
|
||||
from vllm.device_allocator.cumem import CuMemAllocator, cumem_available
|
||||
|
||||
if cumem_available:
|
||||
allocator = CuMemAllocator.get_instance()
|
||||
# Sleep at level 2 discards all pool memory from the GPU
|
||||
# without creating CPU backups — cheapest and fastest.
|
||||
allocator.sleep()
|
||||
logger.debug("[AsyncOmniEngine] Released CuMem memory pool during shutdown")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _try_shutdown(self, *args, **kwargs) -> None:
|
||||
try:
|
||||
self.shutdown()
|
||||
|
||||
@@ -23,6 +23,8 @@ from vllm_omni.engine.stage_client import (
|
||||
StagePoolDiffusionClient,
|
||||
StagePoolLLMClient,
|
||||
)
|
||||
from vllm_omni.data_entry_keys import flatten_payload
|
||||
from vllm_omni.engine.serialization import deserialize_additional_information
|
||||
from vllm_omni.inputs.data import OmniDiffusionSamplingParams
|
||||
from vllm_omni.metrics import definitions as defs
|
||||
from vllm_omni.metrics.stats import StageRequestStats as StageRequestMetrics
|
||||
@@ -1020,8 +1022,30 @@ class StagePool:
|
||||
outputs = await client.get_output_async()
|
||||
if not outputs.outputs:
|
||||
return None
|
||||
self._rehydrate_pooling_output_payloads(outputs)
|
||||
return outputs
|
||||
|
||||
@staticmethod
|
||||
def _rehydrate_pooling_output_payloads(outputs: EngineCoreOutputs) -> None:
|
||||
"""Restore dict-shaped pooling_output from its bytes carrier (MR V2).
|
||||
|
||||
vLLM 0.23 decodes EngineCoreOutput.pooling_output as a torch.Tensor, so MR
|
||||
V2 runners ship the per-request dict handoff via ``pooling_output_payload``
|
||||
with ``pooling_output=None``. Decode it back here so downstream stage-input
|
||||
processors see ``pooling_output`` exactly as on vLLM <= 0.22.
|
||||
"""
|
||||
for eco in outputs.outputs:
|
||||
payload = getattr(eco, "pooling_output_payload", None)
|
||||
if payload is None:
|
||||
continue
|
||||
if getattr(eco, "pooling_output", None) is None:
|
||||
# deserialize_* returns the nested OmniPayload form; the producer
|
||||
# serialized a flat (dotted-key) pooler dict, and downstream
|
||||
# consumers (e.g. talker2code2wav_full_payload) read flat keys like
|
||||
# "codes.audio". Re-flatten to restore the exact on-wire shape.
|
||||
eco.pooling_output = flatten_payload(deserialize_additional_information(payload))
|
||||
eco.pooling_output_payload = None
|
||||
|
||||
async def process_llm_raw_outputs(
|
||||
self,
|
||||
replica_id: int,
|
||||
|
||||
Reference in new issue
Block a user