[diffusion] CI: fix consistency check (#22251)

This commit is contained in:
Mick
2026-04-07 23:43:18 +08:00
committed by GitHub
parent fae90abf6e
commit e7bc23cdab
5 changed files with 57 additions and 49 deletions
@@ -17,7 +17,12 @@ import sys
from pathlib import Path
from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger
from sglang.multimodal_gen.test.run_suite import SUITES, collect_test_items, run_pytest
from sglang.multimodal_gen.test.run_suite import (
SUITES,
_maybe_pin_update_weights_model_pair,
collect_test_items,
run_pytest,
)
logger = init_logger(__name__)
@@ -95,6 +100,7 @@ def main():
# Get files from suite (same as run_suite.py)
suite_files_rel = SUITES[args.suite]
_maybe_pin_update_weights_model_pair(suite_files_rel)
suite_files_abs = []
for f_rel in suite_files_rel:
f_abs = target_dir / f_rel
@@ -49,12 +49,6 @@
"psnr_threshold": 19.0,
"mean_abs_diff_threshold": 10.0
},
"sana_image_t2i": {
"clip_threshold": 0.91,
"ssim_threshold": 0.88,
"psnr_threshold": 21.0,
"mean_abs_diff_threshold": 8.4
},
"qwen_image_edit_2509_ti2i": {
"clip_threshold": 0.92,
"ssim_threshold": 0.65,
@@ -51,14 +51,6 @@ from sglang.multimodal_gen.test.test_utils import (
logger = init_logger(__name__)
def _is_lora_case(case: DiffusionTestCase) -> bool:
return bool(
case.server_args.lora_path
or case.server_args.dynamic_lora_path
or case.server_args.second_lora_path
)
@pytest.fixture
def diffusion_server(case: DiffusionTestCase) -> ServerContext:
"""Start a diffusion server for a single case and tear it down afterwards."""
@@ -81,11 +73,6 @@ def diffusion_server(case: DiffusionTestCase) -> ServerContext:
sampling_params = case.sampling_params
extra_args = os.environ.get("SGLANG_TEST_SERVE_ARGS", "")
# Keep LoRA GT on the normal backend path so adapter state matches CI.
if os.environ.get("SGLANG_GEN_GT", "0") == "1":
if not _is_lora_case(case) and "--backend" not in extra_args:
extra_args = "--backend diffusers " + extra_args.strip()
extra_args += f" --num-gpus {server_args.num_gpus}"
if server_args.tp_size is not None:
@@ -235,18 +222,21 @@ Consider updating perf_baselines.json with the snippets below:
ctx: ServerContext,
case_id: str,
generate_fn: Callable[[str, openai.Client], tuple[str, bytes]],
) -> tuple[RequestPerfRecord, bytes]:
"""Run generation and collect performance records.
collect_perf: bool = True,
) -> tuple[RequestPerfRecord | None, bytes]:
"""Run generation and optionally collect performance records.
Returns:
Tuple of (performance_record, content_bytes)
"""
log_path = ctx.perf_log_path
log_wait_timeout = 30
client = self._client(ctx)
rid, content = generate_fn(case_id, client)
if not collect_perf:
return None, content
log_path = ctx.perf_log_path
log_wait_timeout = 30
req_perf_record = wait_for_req_perf_record(
rid,
log_path,
@@ -1024,6 +1014,7 @@ Repository: https://github.com/sglang-bot/sglang-ci-data (path: diffusion-ci/con
diffusion_server,
case.id,
generate_fn,
collect_perf=not is_gt_gen_mode,
)
if is_gt_gen_mode:
@@ -500,15 +500,6 @@ ONE_GPU_CASES_A: list[DiffusionTestCase] = [
run_lora_dynamic_switch_check=True,
run_multi_lora_api_check=True,
),
DiffusionTestCase(
"sana_image_t2i",
DiffusionServerArgs(
model_path="Efficient-Large-Model/Sana_600M_1024px_diffusers",
modality="image",
),
T2I_sampling_params,
run_perf_check=False,
),
# === Text and Image to Image (TI2I) ===
DiffusionTestCase(
"qwen_image_edit_ti2i",
@@ -804,7 +795,6 @@ ONE_GPU_CASES_C = [
modality="image",
),
T2I_sampling_params,
run_consistency_check=False,
)
]
@@ -945,7 +935,6 @@ TWO_GPU_CASES_A = [
extras=["--pipeline-class-name LTX2TwoStagePipeline"],
),
T2V_sampling_params,
run_consistency_check=False,
),
]