[ROCm][BugFix] Fix shared expert loading error when disable VLLM_ROCM_USE_AITER_FUSION_SHARED_EXPERTS (#28633)

Signed-off-by: ganyi <ygan@amd.com>
This commit is contained in:
Pleaplusone 2025-11-20 15:50:23 +08:00 committed by GitHub
parent 20e4497be2
commit 7218f83992
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -287,7 +287,10 @@ class DeepseekV2MoE(nn.Module):
)
self.is_rocm_aiter_moe_enabled = rocm_aiter_ops.is_fused_moe_enabled()
if config.n_shared_experts is None or self.is_rocm_aiter_moe_enabled:
self.is_fusion_moe_shared_experts_enabled = (
rocm_aiter_ops.is_fusion_moe_shared_experts_enabled()
)
if config.n_shared_experts is None or self.is_fusion_moe_shared_experts_enabled:
self.shared_experts = None
else:
intermediate_size = config.moe_intermediate_size * config.n_shared_experts
@ -327,7 +330,7 @@ class DeepseekV2MoE(nn.Module):
num_redundant_experts=self.n_redundant_experts,
is_sequence_parallel=self.is_sequence_parallel,
n_shared_experts=config.n_shared_experts
if rocm_aiter_ops.is_fusion_moe_shared_experts_enabled()
if self.is_fusion_moe_shared_experts_enabled
else None,
)