Files
vllm-omni/vllm_omni/worker_v2/forward_compat.py
T
Taichang ZhouandClaude Opus 4.8 9678ae58cf [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>
2026-06-20 07:19:40 +00:00

34 lines
1.0 KiB
Python

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Forward-call compatibility helpers for Omni MR V2 runners."""
from __future__ import annotations
from typing import Any
def add_forward_compat_kwargs(
model_inputs: dict[str, Any],
input_batch: Any,
sampler: Any,
) -> None:
"""Add Omni model forward kwargs that V1 model runners provided.
Some Omni model stages inspect these kwargs inside ``forward`` rather
than only in the runner. Qwen2.5-Omni's talker, for example, rewrites
text-model pad ids in ``sampling_metadata`` to a talker-vocab pad id
before sampling codec tokens.
"""
model_inputs.setdefault(
"sampling_metadata",
getattr(input_batch, "sampling_metadata", None),
)
logits_index = getattr(
input_batch,
"logits_indices",
getattr(input_batch, "logits_index", None),
)
model_inputs.setdefault("logits_index", logits_index)
model_inputs.setdefault("sampler", sampler)