[diffusion] quant: update modelopt quantization docs and CI coverage (#22772)
This commit is contained in:
@@ -20,7 +20,7 @@ logger = init_logger(__name__)
|
||||
|
||||
|
||||
class TestDiffusionServerOneGpuB200(DiffusionServerBase):
|
||||
"""B200-targeted smoke tests for 1-GPU diffusion cases."""
|
||||
"""B200-targeted CI tests for 1-GPU ModelOpt diffusion cases."""
|
||||
|
||||
@pytest.fixture(params=ONE_GPU_CASES_C, ids=lambda c: c.id)
|
||||
def case(self, request) -> DiffusionTestCase:
|
||||
|
||||
@@ -78,6 +78,7 @@ def diffusion_server(case: DiffusionTestCase) -> ServerContext:
|
||||
port = int(os.environ.get("SGLANG_TEST_SERVER_PORT", default_port))
|
||||
sampling_params = case.sampling_params
|
||||
extra_args = os.environ.get("SGLANG_TEST_SERVE_ARGS", "")
|
||||
extra_args = f"--model-type diffusion {extra_args}".strip()
|
||||
|
||||
extra_args += f" --num-gpus {server_args.num_gpus}"
|
||||
|
||||
@@ -122,6 +123,7 @@ def diffusion_server(case: DiffusionTestCase) -> ServerContext:
|
||||
env_vars = {}
|
||||
if server_args.enable_cache_dit:
|
||||
env_vars["SGLANG_CACHE_DIT_ENABLED"] = "true"
|
||||
env_vars.update(server_args.env_vars)
|
||||
|
||||
# start server
|
||||
wait_deadline = float(os.environ.get("SGLANG_TEST_WAIT_SECS", "1200"))
|
||||
|
||||
@@ -209,6 +209,7 @@ class DiffusionServerArgs:
|
||||
enable_warmup: bool = True
|
||||
|
||||
extras: list[str] = field(default_factory=lambda: [])
|
||||
env_vars: dict[str, str] = field(default_factory=dict)
|
||||
|
||||
def __post_init__(self):
|
||||
if self.modality is None:
|
||||
@@ -380,6 +381,12 @@ T2I_sampling_params = DiffusionSamplingParams(
|
||||
output_size="1024x1024",
|
||||
)
|
||||
|
||||
MODELOPT_T2I_CI_sampling_params = DiffusionSamplingParams(
|
||||
prompt="Doraemon is eating dorayaki",
|
||||
output_size="768x768",
|
||||
extras={"num_inference_steps": 12},
|
||||
)
|
||||
|
||||
TI2I_sampling_params = DiffusionSamplingParams(
|
||||
prompt="Convert 2D style to 3D style",
|
||||
image_path="https://github.com/lm-sys/lm-sys.github.io/releases/download/test/TI2I_Qwen_Image_Edit_Input.jpg",
|
||||
@@ -416,6 +423,13 @@ T2V_sampling_params = DiffusionSamplingParams(
|
||||
prompt=T2V_PROMPT,
|
||||
)
|
||||
|
||||
MODELOPT_T2V_CI_sampling_params = DiffusionSamplingParams(
|
||||
prompt=T2V_PROMPT,
|
||||
output_size="640x384",
|
||||
num_frames=17,
|
||||
extras={"num_inference_steps": 12},
|
||||
)
|
||||
|
||||
TI2V_sampling_params = DiffusionSamplingParams(
|
||||
prompt="The man in the picture slowly turns his head, his expression enigmatic and otherworldly. The camera performs a slow, cinematic dolly out, focusing on his face. Moody lighting, neon signs glowing in the background, shallow depth of field.",
|
||||
image_path="https://is1-ssl.mzstatic.com/image/thumb/Music114/v4/5f/fa/56/5ffa56c2-ea1f-7a17-6bad-192ff9b6476d/825646124206.jpg/600x600bb.jpg",
|
||||
@@ -754,15 +768,87 @@ if not current_platform.is_hip():
|
||||
)
|
||||
)
|
||||
|
||||
# TODO: enable on 4090/5090
|
||||
ONE_GPU_CASES_C = [
|
||||
DiffusionTestCase(
|
||||
"flux_2_nvfp4_t2i",
|
||||
MODELOPT_FLUX1_FP8_TRANSFORMER = "BBuf/flux1-dev-modelopt-fp8-sglang-transformer"
|
||||
MODELOPT_FLUX2_FP8_TRANSFORMER = "BBuf/flux2-dev-modelopt-fp8-sglang-transformer"
|
||||
MODELOPT_WAN22_FP8_TRANSFORMER = "BBuf/wan22-t2v-a14b-modelopt-fp8-sglang-transformer"
|
||||
MODELOPT_FLUX1_NVFP4_TRANSFORMER = "BBuf/flux1-dev-modelopt-nvfp4-sglang-transformer"
|
||||
MODELOPT_FLUX2_NVFP4_MODEL = "black-forest-labs/FLUX.2-dev-NVFP4"
|
||||
MODELOPT_WAN22_NVFP4_TRANSFORMER = (
|
||||
"BBuf/wan22-t2v-a14b-modelopt-nvfp4-sglang-transformer"
|
||||
)
|
||||
MODELOPT_NVFP4_B200_ENV_VARS = {"SGLANG_DIFFUSION_FLASHINFER_FP4_GEMM_BACKEND": "cudnn"}
|
||||
|
||||
|
||||
def _make_modelopt_ci_case(
|
||||
case_id: str,
|
||||
*,
|
||||
model_path: str,
|
||||
modality: str,
|
||||
sampling_params: DiffusionSamplingParams,
|
||||
extras: list[str],
|
||||
env_vars: dict[str, str] | None = None,
|
||||
) -> DiffusionTestCase:
|
||||
return DiffusionTestCase(
|
||||
case_id,
|
||||
DiffusionServerArgs(
|
||||
model_path="black-forest-labs/FLUX.2-dev-NVFP4",
|
||||
model_path=model_path,
|
||||
modality=modality,
|
||||
enable_warmup=False,
|
||||
extras=extras,
|
||||
env_vars=env_vars or {},
|
||||
),
|
||||
T2I_sampling_params,
|
||||
sampling_params,
|
||||
run_perf_check=False,
|
||||
run_consistency_check=False,
|
||||
)
|
||||
|
||||
|
||||
ONE_GPU_CASES_C = [
|
||||
_make_modelopt_ci_case(
|
||||
"flux1_modelopt_fp8_t2i",
|
||||
model_path=DEFAULT_FLUX_1_DEV_MODEL_NAME_FOR_TEST,
|
||||
modality="image",
|
||||
sampling_params=MODELOPT_T2I_CI_sampling_params,
|
||||
extras=["--transformer-path", MODELOPT_FLUX1_FP8_TRANSFORMER],
|
||||
),
|
||||
_make_modelopt_ci_case(
|
||||
"flux2_modelopt_fp8_t2i",
|
||||
model_path=DEFAULT_FLUX_2_DEV_MODEL_NAME_FOR_TEST,
|
||||
modality="image",
|
||||
sampling_params=MODELOPT_T2I_CI_sampling_params,
|
||||
extras=["--transformer-path", MODELOPT_FLUX2_FP8_TRANSFORMER],
|
||||
),
|
||||
_make_modelopt_ci_case(
|
||||
"wan22_modelopt_fp8_t2v",
|
||||
model_path=DEFAULT_WAN_2_2_T2V_A14B_MODEL_NAME_FOR_TEST,
|
||||
modality="video",
|
||||
sampling_params=MODELOPT_T2V_CI_sampling_params,
|
||||
extras=["--transformer-path", MODELOPT_WAN22_FP8_TRANSFORMER],
|
||||
),
|
||||
_make_modelopt_ci_case(
|
||||
"flux1_modelopt_nvfp4_t2i",
|
||||
model_path=DEFAULT_FLUX_1_DEV_MODEL_NAME_FOR_TEST,
|
||||
modality="image",
|
||||
sampling_params=MODELOPT_T2I_CI_sampling_params,
|
||||
extras=["--transformer-path", MODELOPT_FLUX1_NVFP4_TRANSFORMER],
|
||||
env_vars=MODELOPT_NVFP4_B200_ENV_VARS,
|
||||
),
|
||||
_make_modelopt_ci_case(
|
||||
"flux2_modelopt_nvfp4_t2i",
|
||||
model_path=MODELOPT_FLUX2_NVFP4_MODEL,
|
||||
modality="image",
|
||||
sampling_params=MODELOPT_T2I_CI_sampling_params,
|
||||
extras=[],
|
||||
env_vars=MODELOPT_NVFP4_B200_ENV_VARS,
|
||||
),
|
||||
_make_modelopt_ci_case(
|
||||
"wan22_modelopt_nvfp4_t2v",
|
||||
model_path=DEFAULT_WAN_2_2_T2V_A14B_MODEL_NAME_FOR_TEST,
|
||||
modality="video",
|
||||
sampling_params=MODELOPT_T2V_CI_sampling_params,
|
||||
extras=["--transformer-path", MODELOPT_WAN22_NVFP4_TRANSFORMER],
|
||||
env_vars=MODELOPT_NVFP4_B200_ENV_VARS,
|
||||
),
|
||||
]
|
||||
|
||||
TWO_GPU_CASES_A = [
|
||||
@@ -781,7 +867,7 @@ TWO_GPU_CASES_A = [
|
||||
),
|
||||
T2V_sampling_params,
|
||||
),
|
||||
# TeaCache smoke test for Wan2.2 T2V A14B — verifies enable_teacache=True
|
||||
# TeaCache bring-up test for Wan2.2 T2V A14B — verifies enable_teacache=True
|
||||
# doesn't crash. Perf check disabled because Wan2.2-specific TeaCache
|
||||
# coefficients are not yet calibrated (teacache_params=None, so no speedup).
|
||||
DiffusionTestCase(
|
||||
|
||||
Reference in New Issue
Block a user