sgl-project/sglang · critical · RuntimeError
Checkpoint provides gate weight {name!r} but the model built
Error message
Checkpoint provides gate weight {name!r} but the model built no g_proj (gating is disabled in the config). Set gating to True, "per-head", or "per-element" to load this checkpoint. What it means
During weight loading, Laguna found a checkpoint tensor whose name contains .g_proj. but for which the built model has no parameter (laguna.py:823). The model was constructed with gating disabled, yet the checkpoint contains gate weights, so the load would silently drop them; the code raises to prevent a numerically-wrong model from serving.
Source
Thrown at python/sglang/srt/models/laguna.py:823
param.weight_loader(
param,
loaded_weight,
name,
shard_id=shard_id,
expert_id=expert_id,
)
if layer_id is not None:
loaded_expert_shards.add((layer_id, expert_id, shard_id))
matched_expert = True
break
if matched_expert:
continue
if name.endswith(".bias") and name not in params_dict:
continue
if name not in params_dict:
if ".g_proj." in name:
raise RuntimeError(
f"Checkpoint provides gate weight {name!r} but the model built no "
"g_proj (gating is disabled in the config). Set gating to True, "
'"per-head", or "per-element" to load this checkpoint.'
)
logger.warning("Parameter %s not found in params_dict", name)
continue
param = params_dict[name]
weight_loader = getattr(param, "weight_loader", default_weight_loader)
weight_loader(param, loaded_weight)
# If any routed-expert tensor was silently dropped (e.g. a future
# checkpoint renaming `gate_proj`, or a ckpt-vs-mapping shape mismatch),
# fail loud here instead of generating garbage.
expected = {
(layer_id, expert_id, shard_id)
for layer_id in moe_layer_ids
for expert_id in range(self.config.num_experts)
for shard_id in ("w1", "w2", "w3")View on GitHub (pinned to 0132848349)
Solutions
- Set the model config's gating to True, "per-head", or "per-element" to match the checkpoint
- Re-fetch the matching config.json that shipped with the weights
- Alternatively strip g_proj tensors from the checkpoint (not recommended - changes model numerics)
Example fix
// before (config.json) "gating": false // after "gating": true
Defensive patterns
Strategy: validation
Validate before calling
ckpt_names = list_checkpoint_keys(path)
if any(".g_proj." in n for n in ckpt_names):
assert cfg.gating in (True, "per-head", "per-element") Prevention
- Always pair a checkpoint with its original config.json
- Treat gating mismatches as fatal, not skippable
When it happens
Trigger: Loading a gated Laguna checkpoint into a runtime whose config disables gating (gating=False/None) while the safetensors contain g_proj weights.
Common situations: Mismatched config.json and weight files (config from a non-gated variant, weights from a gated one); hand-editing the gating config field.
Related errors
- Unsupported activation: {hidden_act}. Only silu is supported
- {len(missing)} routed-expert tensors were not loaded (sample
- expected a tensor with at least one dimension
- dimension {dim} size {dim_size} must be divisible by 2 * gro
- f"Invalid prefix for SparseVideoGen2AttentionImpl: {prefix}"
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/40b49d2cdad85df9.
Report an issue: GitHub.