[Performance] Optimize MammothModa2 AR → DiT hidden-state transfer (#7102)

Signed-off-by: kunkunblueberry <1833921874@qq.com>
Signed-off-by: kunkun <72174834+kunkunblueberry@users.noreply.github.com>
This commit is contained in:
kunkun authored and GitHub committed 2026-09-14 15:25:08 -07:00
1 parent 9f85b3722e
commit c68eadbbe0
4 files changed
+212 -5

No files matched your search

@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
"""Stage input processor for MammothModa2 (AR -> DiT)."""
from collections.abc import Mapping
@@ -91,9 +93,11 @@ def ar2dit(
# from the model config. Pass through the raw AR hidden states + token ids and
# the question/answer boundary so the pipeline can reconstruct the masks.
additional_information = {
# float32 so the tensor crosses the stage boundary (the serializer uses
# numpy, which has no bf16); the DiT re-casts to the model dtype.
"full_hidden_states": full_hidden_states.float().contiguous(),
# The EngineCore payload serializer preserves bfloat16 as raw bytes.
# Keep the AR representation compact across the CPU/IPC boundary;
# the DiT selects its conditioning rows and casts them only when it
# consumes them.
"full_hidden_states": full_hidden_states.contiguous(),
"full_token_ids": full_token_ids,
"answer_start_index": [len(prompt_token_ids)],
"image_height": [int(image_height)],