[Bugfix]pass TP size to diffusion config (#2867)

Signed-off-by: natureofnature <wzliu@connect.hku.hk>
This commit is contained in:
NATURE authored and GitHub committed 2026-04-30 11:56:51 +08:00
1 parent 359e474db4
commit bfb730ed50
5 files changed
+108 -19

No files matched your search

@@ -15,18 +15,57 @@ assert_diffusion_response validates successful generation and the expected
512x512 resolution.
"""
import json
import pytest
from tests.helpers.mark import hardware_marks
from tests.helpers.runtime import OmniServer, OmniServerParams, OpenAIClientHandler, dummy_messages_from_mix_data
from tests.helpers.stage_config import get_deploy_config_path
pytestmark = [pytest.mark.diffusion, pytest.mark.full_model]
_BAGEL_DEFAULT_YAML = get_deploy_config_path("ci/bagel.yaml")
PROMPT = "A futuristic city skyline at twilight, cyberpunk style, ultra-detailed, high resolution."
NEGATIVE_PROMPT = "low quality, blurry, distorted, deformed, watermark"
SINGLE_CARD_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"})
PARALLEL_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=2)
TP_FEATURE_MARKS = hardware_marks(res={"cuda": "H100"}, num_cards=3)
def _make_tp_cases(model: str, tp_size: int):
"""Build Bagel TP test cases with devices auto-derived from tp_size.
Devices can not be set through CLI args, so we set them in the YAML.
"""
# Stage 0 uses GPU 0, so place DiT TP ranks on GPU 1..N to
# avoid AR/DiT memory contention on one device.
devices = ",".join(str(i + 1) for i in range(tp_size))
stage_overrides = json.dumps(
{
"0": {"tensor_parallel_size": 1},
"1": {"devices": devices},
}
)
return [
pytest.param(
OmniServerParams(
model=model,
stage_config_path=_BAGEL_DEFAULT_YAML,
server_args=[
"--stage-overrides",
stage_overrides,
"--cache-backend",
"cache_dit",
"--tensor-parallel-size",
str(tp_size),
],
),
id=f"parallel_tp_{tp_size}",
marks=TP_FEATURE_MARKS,
),
]
def _get_diffusion_feature_cases(model: str):
@@ -75,19 +114,9 @@ def _get_diffusion_feature_cases(model: str):
marks=PARALLEL_FEATURE_MARKS,
),
# Tensor-Parallel size 2 (2 GPUs, Cache-DiT backend)
pytest.param(
OmniServerParams(
model=model,
server_args=[
"--cache-backend",
"cache_dit",
"--tensor-parallel-size",
"2",
],
),
id="parallel_tp_2",
marks=[*PARALLEL_FEATURE_MARKS, pytest.mark.skip(reason="issue: #2862")],
),
# Stage 1 (DiT) needs visible GPUs matching TP size; the default YAML
# only exposes device "0", so we patch it here.
*_make_tp_cases(model, tp_size=2),
# Ulysses-SP degree=2 (2 GPUs)
pytest.param(
OmniServerParams(