[NPU] Fix HunyuanImage3 MoE EP+SP parallel mapping (#4344)

Signed-off-by: Celeste-jq <591998922@qq.com>
This commit is contained in:
Jiaqian Liu authored and GitHub committed 2026-07-02 04:14:12 +00:00
1 parent b0f6b9de96
commit a25636d780
5 files changed
+362 -55

No files matched your search

@@ -29,7 +29,7 @@ from transformers.modeling_outputs import (
CausalLMOutputWithPast,
)
from transformers.modeling_utils import PreTrainedModel
from vllm.config import CacheConfig
from vllm.config import CacheConfig, get_current_vllm_config
from vllm.distributed import (
get_tensor_model_parallel_world_size,
)
@@ -1624,6 +1624,7 @@ class HunYuanSparseMoeBlock(nn.Module):
else:
self.shared_mlp = None
enable_expert_parallel = get_current_vllm_config().parallel_config.enable_expert_parallel
self.experts = HunyuanFusedMoE(
shared_experts=self.shared_mlp,
num_experts=self.n_routed_experts,
@@ -1635,7 +1636,7 @@ class HunYuanSparseMoeBlock(nn.Module):
prefix=f"{prefix}.experts",
enable_eplb=self.enable_eplb,
num_redundant_experts=self.n_redundant_experts,
pcp_size=1,
pcp_size=None if enable_expert_parallel else 1,
)
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: