From 5795da5e8389dd312ee81f1e1b1a1941e7e203c5 Mon Sep 17 00:00:00 2001 From: Yuhao Yang <47235274+yhyang201@users.noreply.github.com> Date: Wed, 26 Nov 2025 15:58:23 +0800 Subject: [PATCH] [diffusion] fix: fix the issue where the qwen-edit & wan model produces incorrect output during sequence parallelism (#13922) --- .../configs/pipeline_configs/qwen_image.py | 1 + python/sglang/multimodal_gen/configs/sample/base.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/python/sglang/multimodal_gen/configs/pipeline_configs/qwen_image.py b/python/sglang/multimodal_gen/configs/pipeline_configs/qwen_image.py index d89bb7397..3441a0a17 100644 --- a/python/sglang/multimodal_gen/configs/pipeline_configs/qwen_image.py +++ b/python/sglang/multimodal_gen/configs/pipeline_configs/qwen_image.py @@ -190,6 +190,7 @@ class QwenImagePipelineConfig(ImagePipelineConfig): return latents +@dataclass class QwenImageEditPipelineConfig(QwenImagePipelineConfig): """Configuration for the QwenImageEdit pipeline.""" diff --git a/python/sglang/multimodal_gen/configs/sample/base.py b/python/sglang/multimodal_gen/configs/sample/base.py index 71e9caa26..625defb76 100644 --- a/python/sglang/multimodal_gen/configs/sample/base.py +++ b/python/sglang/multimodal_gen/configs/sample/base.py @@ -225,6 +225,13 @@ class SamplingParams: self.num_frames = 1 self.data_type = DataType.IMAGE else: + # NOTE: We must apply adjust_num_frames BEFORE the SP alignment logic below. + # If we apply it after, adjust_num_frames might modify the frame count + # and break the divisibility constraint (alignment) required by num_gpus. + self.num_frames = server_args.pipeline_config.adjust_num_frames( + self.num_frames + ) + # Adjust number of frames based on number of GPUs for video task use_temporal_scaling_frames = ( pipeline_config.vae_config.use_temporal_scaling_frames @@ -275,10 +282,6 @@ class SamplingParams: ) self.num_frames = new_num_frames - self.num_frames = server_args.pipeline_config.adjust_num_frames( - self.num_frames - ) - self._set_output_file_name() self.log(server_args=server_args)