Skip to content

[diffusion] Add unit test for InputValidationStage.preprocess_condition_image resolution logic#21743

Closed
yeahdongcn wants to merge 1 commit intosgl-project:mainfrom
yeahdongcn:xd/diffusion_ut_input_validation
Closed

[diffusion] Add unit test for InputValidationStage.preprocess_condition_image resolution logic#21743
yeahdongcn wants to merge 1 commit intosgl-project:mainfrom
yeahdongcn:xd/diffusion_ut_input_validation

Conversation

@yeahdongcn
Copy link
Copy Markdown
Collaborator

Motivation

Test InputValidationStage.preprocess_condition_image resolution logic introduced in #21390

Modifications

Accuracy Tests

root@worker3218:/ws# python python/sglang/multimodal_gen/test/unit/test_input_validation.py
2026-03-31 15:40:26 | warnings | 140415011333248 | WARNING : /ws/python/sglang/srt/layers/quantization/awq.py:87: UserWarning: Only CUDA, HIP and XPU support AWQ currently.
  warnings.warn(f"Only CUDA, HIP and XPU support AWQ currently.")

..........2026-03-31 15:40:28 | input_validation | 140415011333248 | WARNING : Requested resolution 3840x2160 exceeds max_area 921600, clamping to max_area
....
----------------------------------------------------------------------
Ran 14 tests in 0.288s

OK

Speed Tests and Profiling

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new unit test suite, test_input_validation.py, to verify the image resolution and preprocessing logic within the InputValidationStage. The tests cover aspect ratio handling, area-based scaling, and dimension alignment for various configurations. Feedback focuses on improving the robustness of the tests by replacing loose assertions with exact dimension checks and using positive type assertions. Additionally, a potential logic discrepancy was identified where the tests assume support for user-defined resolutions that may not be fully implemented in the underlying stage logic.

Comment thread python/sglang/multimodal_gen/test/unit/test_input_validation.py
Comment thread python/sglang/multimodal_gen/test/unit/test_input_validation.py Outdated
Comment thread python/sglang/multimodal_gen/test/unit/test_input_validation.py Outdated
Comment thread python/sglang/multimodal_gen/test/unit/test_input_validation.py Outdated
Comment thread python/sglang/multimodal_gen/test/unit/test_input_validation.py Outdated
Comment thread python/sglang/multimodal_gen/test/unit/test_input_validation.py Outdated
Comment thread python/sglang/multimodal_gen/test/unit/test_input_validation.py Outdated
…on_image resolution logic

Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com>
@yeahdongcn yeahdongcn force-pushed the xd/diffusion_ut_input_validation branch from 058fa29 to 470ef23 Compare March 31, 2026 07:59
@yeahdongcn yeahdongcn closed this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion npu

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant