Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion tests/entrypoints/openai_api/test_video_server.py
Original file line number Diff line number Diff line change
@@ -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 OpenAI-compatible video generation endpoints.
"""
Expand Down Expand Up @@ -566,6 +566,30 @@ def fake_policy(model_class_name, *, model, revision=None):
}


def test_i2v_minimax_h3_preserves_reference_geometry():
engine = FakeAsyncOmni()
engine.model_class_name = "MiniMaxH3Pipeline"
handler = OmniOpenAIServingVideo.for_diffusion(
diffusion_engine=engine,
model_name="MiniMaxAI/MiniMax-H3",
)
image = Image.new("RGB", (48, 32))

asyncio.run(
handler._run_and_extract(
VideoGenerationRequest(prompt="A bear playing with yarn.", width=96, height=64),
"minimax-h3-reference-geometry",
reference_image=ReferenceImage(image),
)
)

input_image = engine.captured_prompt["multi_modal_data"]["image"]
assert isinstance(input_image, Image.Image)
assert input_image.size == (48, 32)
sampling_params = engine.captured_sampling_params_list[0]
assert (sampling_params.width, sampling_params.height) == (96, 64)


def test_i2v_extra_params_dimensions_preserve_input_image_geometry(test_client, mocker: MockerFixture):
image_bytes = _make_test_image_bytes((48, 48))
mocker.patch(
Expand Down
12 changes: 11 additions & 1 deletion tests/model_extras/test_model_extras.py
Original file line number Diff line number Diff line change
@@ -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

from __future__ import annotations

Expand Down Expand Up @@ -271,6 +271,16 @@ def fake_policy(*, model, revision=None):
assert captured == {"model": "org/model", "revision": "pinned-revision"}


@pytest.mark.core_model
@pytest.mark.cpu
@pytest.mark.parametrize("model_class_name", ["MiniMaxH3Pipeline", "MiniMaxH3ModularPipeline"])
def test_minimax_h3_preserves_reference_image_size(model_class_name: str) -> None:
assert should_preserve_reference_image_size(
model_class_name,
model="MiniMaxAI/MiniMax-H3",
)


@pytest.mark.core_model
@pytest.mark.cpu
def test_ming_flash_omni_extra_registry_declares_request_and_response_params() -> None:
Expand Down
21 changes: 20 additions & 1 deletion vllm_omni/model_extras/registry.py
Original file line number Diff line number Diff line change
@@ -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

from __future__ import annotations

Expand Down Expand Up @@ -171,6 +171,16 @@ def default_image_to_image_prompt(
return result


def _always_preserve_reference_image_size(
*,
model: str | None,
revision: str | None = None,
) -> bool:
"""Declare that a pipeline owns reference-image geometry."""
del model, revision
return True


_EXTRA_SPECS: dict[str, dict[str, Any]] = {
"BagelPipeline": {
"extra_body_params": BAGEL_EXTRA_BODY_PARAMS,
Expand Down Expand Up @@ -206,6 +216,15 @@ def default_image_to_image_prompt(
# Shared T2I/I2V envelopes select the output modality. LingBot's
# pipeline owns model-specific validation and normalization.
},
**{
model_class_name: {
"reference_image_size_resolver": _always_preserve_reference_image_size,
}
for model_class_name in (
"MiniMaxH3Pipeline",
"MiniMaxH3ModularPipeline",
)
},
**{
model_class_name: {
"extra_body_params": LTX_EXTRA_BODY_PARAMS,
Expand Down
Loading