Skip to content
Open
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
90 changes: 90 additions & 0 deletions tests/e2e/online_serving/test_omni_gen2_expansion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"""
Online serving diffusion feature coverage for OmniGen2.

Coverage:
- Ulysses-SP
- CFG-Parallel

assert_diffusion_response validates successful generation and the expected
image resolution.
"""

import pytest

from tests.conftest import (
OmniServer,
OmniServerParams,
OpenAIClientHandler,
dummy_messages_from_mix_data,
)
from tests.utils import hardware_marks

MODEL = "OmniGen2/OmniGen2"
PROMPT = "A sleek concept car parked beside a glass building at sunrise, cinematic lighting, ultra detailed."
NEGATIVE_PROMPT = "blurry, low quality, distorted, watermark"

SINGLE_CARD_FEATURE_MARKS = hardware_marks(res={"cuda": "L4"})
PARALLEL_FEATURE_MARKS = {
"usp": hardware_marks(res={"cuda": "L4"}, num_cards=3),
"cfg_parallel": hardware_marks(res={"cuda": "L4"}, num_cards=2),
}


def _get_omnigen2_feature_cases(model: str):
"""Return OmniGen2 online serving cases for SP, and CFG-Parallel."""

return [
pytest.param(
OmniServerParams(
model=model,
server_args=[
"--usp",
"3",
],
),
id="ulysses_sp_3",
marks=PARALLEL_FEATURE_MARKS["usp"],
),
pytest.param(
OmniServerParams(
model=model,
server_args=[
"--cfg-parallel-size",
"2",
Comment on lines +52 to +53

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Drop CFG-parallel case for OmniGen2 expansion test

This case claims CFG-parallel coverage for OmniGen2, but OmniGen2Pipeline does not use CFGParallelMixin (or any rank-aware CFG split path), so --cfg-parallel-size 2 does not actually exercise CFG-parallel behavior and can pass while that feature is effectively untested for this model. In practice this creates false confidence: regressions in real CFG-parallel execution would not be caught by this test.

Useful? React with 👍 / 👎.

],
),
id="cfg_parallel_2",
marks=PARALLEL_FEATURE_MARKS["cfg_parallel"],
),
]


@pytest.mark.advanced_model
@pytest.mark.diffusion
@pytest.mark.parametrize(
"omni_server",
_get_omnigen2_feature_cases(MODEL),
indirect=True,
)
def test_omnigen2(
omni_server: OmniServer,
openai_client: OpenAIClientHandler,
):
"""Validate OmniGen2 online serving for SP, and CFG-Parallel."""

messages = dummy_messages_from_mix_data(content_text=PROMPT)

request_config = {
"model": omni_server.model,
"messages": messages,
"extra_body": {
"height": 1024,
"width": 1024,
"num_inference_steps": 2,
"negative_prompt": NEGATIVE_PROMPT,
"guidance_scale": 4.0,
"seed": 42,
},
}

openai_client.send_diffusion_request(request_config)
Loading