You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mlxcel's Qwen3.5-MoE weight sanitization handles the fused experts.gate_up_proj layout and the per-expert experts.{e}.{w1,w2,w3}.weight layout, but NOT the per-expert layout that names tensors experts.{e}.gate_proj.weight / up_proj.weight / down_proj.weight. Such checkpoints fail to load with Missing weight: model.layers.N.mlp.switch_mlp.w1.
Current state
sanitize_weights step 6 (src/models/qwen3_5.rs:2350-2398) only stacks per-expert tensors named experts.{e}.{w1,w2,w3}.weight.
The fused experts.gate_up_proj path (step 7, qwen3_5.rs:2400-2431) is handled (slice at mid = shape[-2]//2).
qwen3_5 uses the qwen3_next-local SwitchLinear::from_weights (src/models/qwen3_next.rs:976-1002), which requires a pre-stacked {prefix}.weight and has NO per-expert fallback (unlike the shared src/models/switch_layers.rs::stack_individual_experts, lines 277-315, which does stack gate_proj/up_proj/down_proj for Qwen2-MoE/Mixtral).
What needs to change
In sanitize_weights step 6, also match experts.{e}.{gate_proj,up_proj,down_proj}.weight, stacking across e in 0..num_experts into switch_mlp.{w1,w3,w2} (gate->w1, up->w3, down->w2), mirroring the fused path's naming. Handle any per-expert quantized scales/biases.
Acceptance criteria
A Qwen3.5-MoE checkpoint shipping per-expert gate_proj-named experts loads without Missing weight.
Output matches the fused-layout checkpoint for the same model (parity).
Unit test with a synthetic per-expert gate_proj-named weight map.
Activity