[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
+41 -13
View File
@@ -22,6 +22,10 @@ permissions:
contents: write
actions: read
env:
SGLANG_IS_IN_CI: true
SGLANG_CUDA_COREDUMP: "1"
jobs:
multimodal-diffusion-gen-1gpu:
if: github.repository == 'sgl-project/sglang'
@@ -40,6 +44,8 @@ jobs:
run: bash scripts/ci/cuda/ci_install_dependency.sh diffusion
- name: Generate outputs
env:
RUNAI_STREAMER_MEMORY_LIMIT: 0
run: |
cd python
python -m sglang.multimodal_gen.test.scripts.gen_diffusion_ci_outputs \
@@ -56,6 +62,11 @@ jobs:
path: python/diffusion-ci-outputs
retention-days: 7
- name: Publish GT images to sglang-bot/sglang-ci-data
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
run: python scripts/ci/utils/diffusion/publish_diffusion_gt.py --source-dir python/diffusion-ci-outputs
multimodal-diffusion-gen-2gpu:
if: github.repository == 'sgl-project/sglang'
runs-on: 2-gpu-h100
@@ -73,6 +84,8 @@ jobs:
run: bash scripts/ci/cuda/ci_install_dependency.sh diffusion
- name: Generate outputs
env:
RUNAI_STREAMER_MEMORY_LIMIT: 0
run: |
cd python
python -m sglang.multimodal_gen.test.scripts.gen_diffusion_ci_outputs \
@@ -89,27 +102,42 @@ jobs:
path: python/diffusion-ci-outputs
retention-days: 7
diffusion-ci-push:
needs: [multimodal-diffusion-gen-1gpu, multimodal-diffusion-gen-2gpu]
- name: Publish GT images to sglang-bot/sglang-ci-data
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
run: python scripts/ci/utils/diffusion/publish_diffusion_gt.py --source-dir python/diffusion-ci-outputs
multimodal-diffusion-gen-b200:
if: github.repository == 'sgl-project/sglang'
runs-on: ubuntu-latest
runs-on: 4-gpu-b200
timeout-minutes: 240
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: diffusion-gen-*
path: combined
merge-multiple: true
ref: ${{ inputs.ref || github.ref }}
- name: Collect image files
- name: Install dependencies
run: bash scripts/ci/cuda/ci_install_dependency.sh diffusion
- name: Generate outputs
env:
RUNAI_STREAMER_MEMORY_LIMIT: 0
run: |
mkdir -p gt_images
find combined \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.webp" \) -type f -exec cp -f {} gt_images/ \;
cd python
python -m sglang.multimodal_gen.test.scripts.gen_diffusion_ci_outputs \
--suite 1-gpu-b200 \
--out-dir ./diffusion-ci-outputs \
${{ inputs.case_ids != '' && format('--case-ids {0}', inputs.case_ids) || '' }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: diffusion-gen-b200
path: python/diffusion-ci-outputs
retention-days: 7
- name: Publish GT images to sglang-bot/sglang-ci-data
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
run: python scripts/ci/utils/diffusion/publish_diffusion_gt.py --source-dir gt_images
run: python scripts/ci/utils/diffusion/publish_diffusion_gt.py --source-dir python/diffusion-ci-outputs
@@ -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,
),
]