[diffusion] fix: fix rank used in parallel executor when enable_cfg_parallel is false (#18975)

Co-authored-by: daiweitao <dwti614707404@163.com>
This commit is contained in:
Prozac614
2026-02-19 20:12:24 +08:00
committed by GitHub
parent 19aa19b111
commit e21fc78dbd

View File

@@ -8,6 +8,7 @@ from sglang.multimodal_gen.runtime.distributed import get_sp_group
from sglang.multimodal_gen.runtime.distributed.parallel_state import (
get_cfg_group,
get_classifier_free_guidance_rank,
get_world_rank,
)
from sglang.multimodal_gen.runtime.pipelines_core import Req
from sglang.multimodal_gen.runtime.pipelines_core.executors.pipeline_executor import (
@@ -60,7 +61,10 @@ class ParallelExecutor(PipelineExecutor):
"""
Execute all pipeline stages respecting their declared parallelism type.
"""
rank = get_classifier_free_guidance_rank()
if server_args.enable_cfg_parallel:
rank = get_classifier_free_guidance_rank()
else:
rank = get_world_rank()
cfg_group = get_cfg_group()
# TODO: decide when to gather on main when CFG_PARALLEL -> MAIN_RANK_ONLY