vllm.model_executor.models.qwen3_moe ¶
Inference-only Qwen3MoE model compatible with HuggingFace weights.
_build_expert_mapping ¶
_build_expert_mapping(
model: Module,
num_experts: int,
num_redundant_experts: int,
) -> list[tuple[str, str, int, str]]
Return the expert weight mapping consumed by FusedMoE.load_weights.
Combines the per-expert mapping (experts..{gate_proj,up_proj,down_proj}) with three aliases for HF's fused-MoE checkpoint layout (transformers
= v5, and any v4 checkpoint re-saved with save_original_format=False): experts.gate_up_proj of shape (E, 2*I, H) and experts.down_proj of shape (E, H, I). For the fused aliases expert_id is repurposed as shard_idx (0=gate, 1=up) by FusedMoE.load_weights' dim()==3 branch. See vllm/model_executor/models/transformers/moe.py for the same pattern.