[diffusion] CI: warm up CI cases at the request's quality level (#42958)
This commit is contained in:
@@ -29,6 +29,7 @@ from pathlib import Path
|
||||
from typing import Any, Sequence
|
||||
|
||||
from sglang.multimodal_gen.configs.pipeline_configs.base import ModelTaskType
|
||||
from sglang.multimodal_gen.configs.sample.sampling_params import normalize_quality
|
||||
from sglang.multimodal_gen.registry import (
|
||||
get_model_info,
|
||||
get_pipeline_config_classes,
|
||||
@@ -381,6 +382,21 @@ class DiffusionTestCase:
|
||||
extras={**self.sampling_params.extras, "quality": "exact"},
|
||||
),
|
||||
)
|
||||
# Warmup must run the request's level: a request below the server default
|
||||
# unmounts the fusions warmup mounted, so its timed run is the first pass
|
||||
# over an unwarmed path.
|
||||
request_quality = self.sampling_params.extras.get("quality")
|
||||
if request_quality is not None:
|
||||
object.__setattr__(
|
||||
self,
|
||||
"server_args",
|
||||
replace(
|
||||
self.server_args,
|
||||
extras=_with_warmup_quality(
|
||||
self.server_args.extras, normalize_quality(request_quality)
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
has_startup_lora = self.server_args.lora_path is not None
|
||||
has_dynamic_lora = self.server_args.dynamic_lora_path is not None
|
||||
@@ -875,6 +891,37 @@ HUNYUAN3D_SHAPE_sampling_params = DiffusionSamplingParams(
|
||||
)
|
||||
|
||||
|
||||
def _with_warmup_quality(extras: Sequence[str], quality: str) -> list[str]:
|
||||
"""Return ``extras`` with ``quality`` in ``--warmup-sampling-params``.
|
||||
|
||||
Merges into an existing JSON object and keeps a quality the case set itself.
|
||||
"""
|
||||
option = "--warmup-sampling-params"
|
||||
|
||||
def with_quality(raw: str) -> str:
|
||||
params = json.loads(raw)
|
||||
params.setdefault("quality", quality)
|
||||
return json.dumps(params)
|
||||
|
||||
merged: list[str] = []
|
||||
found = False
|
||||
for item in extras:
|
||||
tokens = shlex.split(item)
|
||||
changed = False
|
||||
for index, token in enumerate(tokens):
|
||||
if token.startswith(f"{option}="):
|
||||
tokens[index] = f"{option}={with_quality(token[len(option) + 1 :])}"
|
||||
changed = True
|
||||
elif token == option and index + 1 < len(tokens):
|
||||
tokens[index + 1] = with_quality(tokens[index + 1])
|
||||
changed = True
|
||||
merged.append(shlex.join(tokens) if changed else item)
|
||||
found = found or changed
|
||||
if not found:
|
||||
merged.append(f"{option} {shlex.quote(json.dumps({'quality': quality}))}")
|
||||
return merged
|
||||
|
||||
|
||||
def _get_extra_arg_value(extras: Sequence[str], option_name: str) -> str | None:
|
||||
tokens: list[str] = []
|
||||
for item in extras:
|
||||
|
||||
@@ -13,6 +13,7 @@ Covers warmup and cfg-parallel guard paths introduced alongside this file:
|
||||
All tests are CPU-only; no model loading, no distributed init.
|
||||
"""
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from collections import deque
|
||||
from types import SimpleNamespace
|
||||
@@ -32,7 +33,10 @@ from sglang.multimodal_gen.configs.pipeline_configs.sana_wm import SanaWMPipelin
|
||||
from sglang.multimodal_gen.configs.sample.longlive2 import LongLive2SamplingParams
|
||||
from sglang.multimodal_gen.configs.sample.ltx_2_5 import LTX25SamplingParams
|
||||
from sglang.multimodal_gen.configs.sample.minimax_h3 import MiniMaxH3SamplingParams
|
||||
from sglang.multimodal_gen.configs.sample.sampling_params import SamplingParams
|
||||
from sglang.multimodal_gen.configs.sample.sampling_params import (
|
||||
SamplingParams,
|
||||
normalize_quality,
|
||||
)
|
||||
from sglang.multimodal_gen.configs.sample.sana_wm import SanaWMSamplingParams
|
||||
from sglang.multimodal_gen.runtime.entrypoints.control_requests import (
|
||||
SetLoraReq,
|
||||
@@ -65,7 +69,10 @@ from sglang.multimodal_gen.runtime.warmup_request_builder import (
|
||||
supports_synthetic_warmup,
|
||||
)
|
||||
from sglang.multimodal_gen.test.server.gpu_cases import ONE_GPU_CASES, TWO_GPU_CASES
|
||||
from sglang.multimodal_gen.test.server.testcase_configs import _get_extra_arg_value
|
||||
from sglang.multimodal_gen.test.server.testcase_configs import (
|
||||
_get_extra_arg_value,
|
||||
_with_warmup_quality,
|
||||
)
|
||||
|
||||
|
||||
def _make_bare_scheduler(enable_cfg_parallel: bool) -> Scheduler:
|
||||
@@ -707,6 +714,41 @@ class TestWarmupReqCfgParallel(unittest.TestCase):
|
||||
self.assertEqual((reqs[0].width, reqs[0].height), (384, 640))
|
||||
self.assertEqual(reqs[0].num_frames, case.sampling_params.num_frames)
|
||||
|
||||
def test_ci_warmup_runs_the_request_quality(self):
|
||||
"""A request below the server default level unmounts the fusions warmup
|
||||
mounted, so its timed run takes an unwarmed path; warmup must match."""
|
||||
for case in ONE_GPU_CASES + TWO_GPU_CASES:
|
||||
request_quality = case.sampling_params.extras.get("quality")
|
||||
if request_quality is None:
|
||||
continue
|
||||
warmup = _get_extra_arg_value(
|
||||
case.server_args.extras, "--warmup-sampling-params"
|
||||
)
|
||||
self.assertIsNotNone(warmup, case.id)
|
||||
self.assertEqual(
|
||||
json.loads(warmup)["quality"],
|
||||
normalize_quality(request_quality),
|
||||
case.id,
|
||||
)
|
||||
|
||||
def test_warmup_quality_merges_into_existing_warmup_params(self):
|
||||
merged = _with_warmup_quality(
|
||||
["--load-x", """--warmup-sampling-params '{"num_frames": 9}'"""],
|
||||
"exact",
|
||||
)
|
||||
self.assertEqual(
|
||||
json.loads(_get_extra_arg_value(merged, "--warmup-sampling-params")),
|
||||
{"num_frames": 9, "quality": "exact"},
|
||||
)
|
||||
self.assertEqual(merged[0], "--load-x")
|
||||
kept = _with_warmup_quality(
|
||||
["""--warmup-sampling-params='{"quality": "lossless"}'"""], "exact"
|
||||
)
|
||||
self.assertEqual(
|
||||
json.loads(_get_extra_arg_value(kept, "--warmup-sampling-params")),
|
||||
{"quality": "lossless"},
|
||||
)
|
||||
|
||||
def test_ltx25_ci_warmup_matches_formal_decoder_and_shape(self):
|
||||
case = next(
|
||||
case
|
||||
|
||||
Reference in New Issue
Block a user