load_moe_gemma4

Function load_moe_gemma4 

Source
pub fn load_moe_gemma4(
    store: &WeightStore,
    layer_prefix: &str,
    num_experts: usize,
    gpu: &dyn GpuBackend,
    config: &ModelConfig,
    variant: Nvfp4Variant,
    qctx: QuantizeCtx,
) -> Result<MoeWeights>
Expand description

2026-09-25: Load a Gemma-4 MoE block.

  • The router is {lp}.router.proj.weight, kept unfused as the gate.
  • router.scale [H] becomes router_pre_norm (scale * hidden_size^-0.5).
  • router.per_expert_scale [E] is folded into each expert’s down_proj weight_scale_2.
  • Experts are {lp}.moe.experts.{e}; the shared expert is zero-filled.
  • The gate and both router scales are read as BF16 without a dtype check.