[diffusion] fix: do not warn that the recommended short edge is unverified (#35745)
This commit is contained in:
+6
-1
@@ -16,6 +16,7 @@ from typing import Any
|
|||||||
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.constants import (
|
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.constants import (
|
||||||
MINIMAX_H3_MAX_DURATION_SECONDS,
|
MINIMAX_H3_MAX_DURATION_SECONDS,
|
||||||
MINIMAX_H3_MIN_DURATION_SECONDS,
|
MINIMAX_H3_MIN_DURATION_SECONDS,
|
||||||
|
MINIMAX_H3_RECOMMENDED_SHORT_EDGE,
|
||||||
MINIMAX_H3_SUPPORTED_FPS,
|
MINIMAX_H3_SUPPORTED_FPS,
|
||||||
warn_unverified_short_edge,
|
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")
|
short_edge = _require_int(target.get("short_edge"), f"{path}.short_edge")
|
||||||
if short_edge <= 0:
|
if short_edge <= 0:
|
||||||
raise ValueError(f"{path}.short_edge must be positive, got {short_edge}")
|
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")
|
aspect_ratio = _require_str(target.get("aspect_ratio"), f"{path}.aspect_ratio")
|
||||||
if profile.aspect_ratio_forced_auto and aspect_ratio != "auto":
|
if profile.aspect_ratio_forced_auto and aspect_ratio != "auto":
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import pytest
|
|||||||
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3 import (
|
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3 import (
|
||||||
constants,
|
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 (
|
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.resolved_plan import (
|
||||||
MINIMAX_H3_BASE_SHORT_EDGE,
|
MINIMAX_H3_BASE_SHORT_EDGE,
|
||||||
MINIMAX_H3_CANVAS_MULTIPLE,
|
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)
|
@pytest.fixture(autouse=True)
|
||||||
def _reset_warn_cache():
|
def _reset_warn_cache():
|
||||||
constants.warn_unverified_short_edge.cache_clear()
|
constants.warn_unverified_short_edge.cache_clear()
|
||||||
@@ -70,3 +87,16 @@ class TestWarning:
|
|||||||
)
|
)
|
||||||
assert caplog.text.count("outside the verified configuration") == 1
|
assert caplog.text.count("outside the verified configuration") == 1
|
||||||
assert "768" in caplog.text
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user