[diffusion] fix: fix wrong validation on 2k resolution (#15478)

This commit is contained in:
Mick
2025-12-19 21:28:45 +08:00
committed by GitHub
parent 1e58248808
commit ff1e2ce24d
5 changed files with 18 additions and 21 deletions
@@ -3,8 +3,18 @@ Benchmark online serving for diffusion models (Image/Video Generation).
Usage: Usage:
# Video
t2v: t2v:
python3 -m sglang.multimodal_gen.benchmarks.bench_serving \
--backend sglang-video --dataset vbench --task t2v --num-prompts 20
i2v:
python3 -m sglang.multimodal_gen.benchmarks.bench_serving \
--backend sglang-video --dataset vbench --task i2v --num-prompts 20
# Image
t2i:
python3 -m sglang.multimodal_gen.benchmarks.bench_serving \ python3 -m sglang.multimodal_gen.benchmarks.bench_serving \
--backend sglang-image --dataset vbench --task t2v --num-prompts 20 --backend sglang-image --dataset vbench --task t2v --num-prompts 20
@@ -13,8 +23,6 @@ Usage:
--backend sglang-image --dataset vbench --task i2v --num-prompts 20 --backend sglang-image --dataset vbench --task i2v --num-prompts 20
""" """
import argparse import argparse
@@ -258,7 +258,7 @@ class SamplingParams:
if pipeline_config.task_type.is_image_gen(): if pipeline_config.task_type.is_image_gen():
# settle num_frames # settle num_frames
logger.debug(f"Setting num_frames to 1 because this is an image-gen model") logger.debug(f"num_frames set to 1 for image generation model")
self.num_frames = 1 self.num_frames = 1
self.data_type = DataType.IMAGE self.data_type = DataType.IMAGE
elif self.adjust_frames: elif self.adjust_frames:
@@ -1 +1,7 @@
# Copied and adapted from: https://github.com/hao-ai-lab/FastVideo # Copied and adapted from: https://github.com/hao-ai-lab/FastVideo
from sglang.multimodal_gen.runtime.utils.logging_utils import suppress_loggers
# globally suppress some obsessive loggers
suppress_loggers(
["imageio", "imageio_ffmpeg", "PIL", "PIL_Image", "multipart", "filelock"]
)
@@ -34,11 +34,8 @@ from sglang.multimodal_gen.runtime.utils.logging_utils import (
init_logger, init_logger,
log_batch_completion, log_batch_completion,
log_generation_timer, log_generation_timer,
suppress_loggers,
) )
suppress_loggers(["imageio", "imageio_ffmpeg", "PIL", "PIL_Image"])
logger = init_logger(__name__) logger = init_logger(__name__)
# TODO: move to somewhere appropriate # TODO: move to somewhere appropriate
@@ -52,7 +49,6 @@ except RuntimeError:
pass pass
# TODO: rename
class DiffGenerator: class DiffGenerator:
""" """
A unified class for generating images/videos using diffusion models. A unified class for generating images/videos using diffusion models.
@@ -413,9 +409,6 @@ class DiffGenerator:
sync_scheduler_client.close() sync_scheduler_client.close()
self.owns_scheduler_client = False self.owns_scheduler_client = False
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):
self.shutdown() self.shutdown()
@@ -294,16 +294,6 @@ class InputValidationStage(PipelineStage):
result = VerificationResult() result = VerificationResult()
result.add_check("height", batch.height, V.positive_int) result.add_check("height", batch.height, V.positive_int)
result.add_check("width", batch.width, V.positive_int) result.add_check("width", batch.width, V.positive_int)
# Validate height and width
def check_size(value: int, name: str):
if value % (8 * server_args.num_gpus) != 0:
raise ValueError(
f"{name} must be divisible by (8 x num_gpus) but {value} % (8 * {server_args.num_gpus}) != 0."
)
check_size(batch.height, "Height")
check_size(batch.width, "Width")
result.add_check("seeds", batch.seeds, V.list_not_empty) result.add_check("seeds", batch.seeds, V.list_not_empty)
result.add_check("generator", batch.generator, V.generator_or_list_generators) result.add_check("generator", batch.generator, V.generator_or_list_generators)
return result return result