[Model][MiniMax-H3] Multi-GPU serving fixes and layer-wise offload component selection (#7047)
Signed-off-by: heyuanliu-intel <heyuan.liu@intel.com>
This commit is contained in:
1 parent
2f1a18e69f
commit
40f8e94400
21 files changed
+1857
-60
No files matched your search
@@ -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
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
@@ -190,3 +190,90 @@ def test_condition_noise_accepts_a_reference_video_longer_than_the_target():
|
||||
noise_aug=0.5,
|
||||
)
|
||||
assert result.shape == rows.shape
|
||||
|
||||
|
||||
def test_explicit_seq_len_pins_one_shape_across_prompt_lengths():
|
||||
"""Prompts of different token counts must land on the same packed length.
|
||||
|
||||
Without the pin they fall into different 64-row buckets, and each bucket is
|
||||
a packed shape the compiled transformer has not seen before.
|
||||
"""
|
||||
from vllm_omni.diffusion.models.minimax_h3.packed_sequence import (
|
||||
minimax_h3_packed_sequence,
|
||||
)
|
||||
|
||||
common = dict(
|
||||
latent_t=2,
|
||||
latent_h=4,
|
||||
latent_w=6,
|
||||
audio_t=3,
|
||||
include_keyframe_cond=False,
|
||||
)
|
||||
# used = text_len + 18 rows: 22 -> bucket 64; 118 -> bucket 128.
|
||||
short = minimax_h3_packed_sequence(text_len=4, **common)
|
||||
long = minimax_h3_packed_sequence(text_len=100, **common)
|
||||
assert int(short["seq_len"]) == 64
|
||||
assert int(long["seq_len"]) == 128
|
||||
|
||||
short_pinned = minimax_h3_packed_sequence(text_len=4, seq_len=192, **common)
|
||||
long_pinned = minimax_h3_packed_sequence(text_len=100, seq_len=192, **common)
|
||||
assert int(short_pinned["seq_len"]) == int(long_pinned["seq_len"]) == 192
|
||||
# The pin only adds padding rows; the used prefix is untouched.
|
||||
assert int(short_pinned["cu_seqlens"][1]) == int(short["cu_seqlens"][1]) == 22
|
||||
assert int(long_pinned["cu_seqlens"][1]) == int(long["cu_seqlens"][1]) == 118
|
||||
assert short_pinned["img_pos"].tolist() == short["img_pos"].tolist()
|
||||
|
||||
|
||||
def test_the_ref2va_packer_pins_one_shape_across_prompt_lengths_too():
|
||||
"""Both packers share one resolver, so both honour the pin."""
|
||||
from vllm_omni.diffusion.models.minimax_h3.packed_sequence import (
|
||||
minimax_h3_packed_sequence_ref2va_blocks,
|
||||
)
|
||||
|
||||
common = dict(
|
||||
latent_t=2,
|
||||
latent_h=4,
|
||||
latent_w=6,
|
||||
audio_t=3,
|
||||
ref_blocks=[{"kind": "audio", "ref_audio_t": 1}],
|
||||
)
|
||||
short = minimax_h3_packed_sequence_ref2va_blocks(text_len=4, **common)
|
||||
long = minimax_h3_packed_sequence_ref2va_blocks(text_len=100, **common)
|
||||
assert int(short["seq_len"]) != int(long["seq_len"])
|
||||
|
||||
short_pinned = minimax_h3_packed_sequence_ref2va_blocks(text_len=4, seq_len=192, **common)
|
||||
long_pinned = minimax_h3_packed_sequence_ref2va_blocks(text_len=100, seq_len=192, **common)
|
||||
assert int(short_pinned["seq_len"]) == int(long_pinned["seq_len"]) == 192
|
||||
assert int(short_pinned["cu_seqlens"][1]) == int(short["cu_seqlens"][1])
|
||||
assert int(long_pinned["cu_seqlens"][1]) == int(long["cu_seqlens"][1])
|
||||
|
||||
|
||||
def test_explicit_seq_len_below_used_rows_is_a_client_error():
|
||||
"""Both packers reject an under-sized pin as a 4xx, not a server error."""
|
||||
from vllm_omni.diffusion.models.minimax_h3.packed_sequence import (
|
||||
minimax_h3_packed_sequence,
|
||||
minimax_h3_packed_sequence_ref2va_blocks,
|
||||
)
|
||||
from vllm_omni.errors import OmniClientError
|
||||
|
||||
with pytest.raises(OmniClientError, match="used rows"):
|
||||
minimax_h3_packed_sequence(
|
||||
text_len=4,
|
||||
latent_t=2,
|
||||
latent_h=4,
|
||||
latent_w=6,
|
||||
audio_t=3,
|
||||
include_keyframe_cond=False,
|
||||
seq_len=8,
|
||||
)
|
||||
|
||||
with pytest.raises(OmniClientError, match="used rows"):
|
||||
minimax_h3_packed_sequence_ref2va_blocks(
|
||||
text_len=4,
|
||||
latent_t=2,
|
||||
latent_h=4,
|
||||
latent_w=6,
|
||||
audio_t=3,
|
||||
ref_blocks=[{"kind": "audio", "ref_audio_t": 1}],
|
||||
seq_len=8,
|
||||
)
|
||||
Reference in new issue
Block a user