From 932f63215849cd1b8d95e41d97803c65fc23ef5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=B9=A4=E7=94=B7?= Date: Fri, 21 Aug 2026 22:56:03 +0800 Subject: [PATCH] [diffusion] fix: do not warn that the recommended short edge is unverified (#35745) --- .../minimax_h3/request_validation.py | 7 ++++- .../test/unit/test_minimax_h3_short_edge.py | 30 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py index f3874c2b8..a49ac3384 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py @@ -16,6 +16,7 @@ from typing import Any from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.constants import ( MINIMAX_H3_MAX_DURATION_SECONDS, MINIMAX_H3_MIN_DURATION_SECONDS, + MINIMAX_H3_RECOMMENDED_SHORT_EDGE, MINIMAX_H3_SUPPORTED_FPS, warn_unverified_short_edge, ) @@ -86,7 +87,11 @@ def _validate_target(target: Any, *, profile: MiniMaxH3TaskProfile) -> dict[str, short_edge = _require_int(target.get("short_edge"), f"{path}.short_edge") if short_edge <= 0: raise ValueError(f"{path}.short_edge must be positive, got {short_edge}") - warn_unverified_short_edge(short_edge) + if short_edge != MINIMAX_H3_RECOMMENDED_SHORT_EDGE: + # Same guard the resolver applies. Without it the recommended value warns + # that it is "outside the verified configuration", naming itself as the + # verified one. + warn_unverified_short_edge(short_edge) aspect_ratio = _require_str(target.get("aspect_ratio"), f"{path}.aspect_ratio") if profile.aspect_ratio_forced_auto and aspect_ratio != "auto": raise ValueError( diff --git a/python/sglang/multimodal_gen/test/unit/test_minimax_h3_short_edge.py b/python/sglang/multimodal_gen/test/unit/test_minimax_h3_short_edge.py index 6cb95a30c..f1bc07ed8 100644 --- a/python/sglang/multimodal_gen/test/unit/test_minimax_h3_short_edge.py +++ b/python/sglang/multimodal_gen/test/unit/test_minimax_h3_short_edge.py @@ -5,6 +5,9 @@ import pytest from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3 import ( constants, ) +from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.request_validation import ( + minimax_h3_validate_canonical_request, +) from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.resolved_plan import ( MINIMAX_H3_BASE_SHORT_EDGE, MINIMAX_H3_CANVAS_MULTIPLE, @@ -13,6 +16,20 @@ from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.m ) +def _validate(short_edge): + return minimax_h3_validate_canonical_request( + task="t2va", + prompt="short edge warning", + conditions=[], + target={ + "short_edge": short_edge, + "aspect_ratio": "16:9", + "duration_seconds": 5.0, + }, + seed=0, + ) + + @pytest.fixture(autouse=True) def _reset_warn_cache(): constants.warn_unverified_short_edge.cache_clear() @@ -70,3 +87,16 @@ class TestWarning: ) assert caplog.text.count("outside the verified configuration") == 1 assert "768" in caplog.text + + def test_request_validation_does_not_warn_about_the_recommended_edge(self, caplog): + # Request admission is the first thing every request hits, so an + # unconditional warning here fires on the released 768 configuration and + # names 768 as the verified one in the same sentence. + with caplog.at_level("WARNING"): + _validate(MINIMAX_H3_BASE_SHORT_EDGE) + assert "outside the verified configuration" not in caplog.text + + def test_request_validation_warns_about_an_unverified_edge(self, caplog): + with caplog.at_level("WARNING"): + _validate(480) + assert "outside the verified configuration" in caplog.text