[Bugfix]: SP attention not enabling when _sp_plan hooks are not applied (#1704)

Signed-off-by: Didan Deng <33117903+wtomin@users.noreply.github.com>
Co-authored-by: Canlin Guo <961750412@qq.com>
This commit is contained in:
Didan DengandCanlin Guo authored and GitHub committed 2026-03-11 10:49:42 +08:00
1 parent 6ac85d4607
commit 7543f2ff3b
3 files changed
+60 -16

No files matched your search

+6
View File
@@ -10,6 +10,7 @@ from vllm.model_executor.models.registry import _LazyRegisteredModel, _ModelRegi
from vllm_omni.diffusion.data import OmniDiffusionConfig
from vllm_omni.diffusion.distributed.autoencoders.distributed_vae_executor import DistributedVaeMixin
from vllm_omni.diffusion.distributed.sp_plan import SequenceParallelConfig, get_sp_plan_from_model
from vllm_omni.diffusion.forward_context import get_forward_context
from vllm_omni.diffusion.hooks.sequence_parallel import apply_sequence_parallel
logger = init_logger(__name__)
@@ -264,6 +265,11 @@ def _apply_sequence_parallel_if_enabled(model, od_config: OmniDiffusionConfig) -
apply_sequence_parallel(transformer, sp_config, plan)
applied_count += 1
# update forward context sp_plan_hooks_applied
ctx = get_forward_context()
ctx.sp_plan_hooks_applied = applied_count > 0
logger.debug(f"Setting sp_plan_hooks_applied={ctx.sp_plan_hooks_applied} in ``ForwardContext``!")
if applied_count == 0:
logger.warning(
f"Sequence parallelism is enabled (sp_size={sp_size}) but no transformer with _sp_plan found. "