sgl-project/sglang · error · ValueError
layer_types disagrees with no_rope_layers (NoPE layers must
Error message
layer_types disagrees with no_rope_layers (NoPE layers must be the full_attention layers) at layer indices {mismatches} What it means
layer_types and no_rope_layers must agree: NoPE layers (flag 0) are exactly the full_attention layers and RoPE layers (flag 1) are the sliding_attention layers. When an explicit layer_types list is given, it is zipped against the derived list and any index where they differ is reported.
Source
Thrown at python/sglang/srt/hardware_backend/mlx/models/muse_glimmer_mlx.py:317
f"num_hidden_layers is {self.num_hidden_layers}"
)
bad = sorted(
set(self.layer_types) - {"full_attention", "sliding_attention"}
)
if bad:
raise ValueError(
f"layer_types contains unknown entries {bad}; expected only "
"'full_attention' or 'sliding_attention'"
)
if self.layer_types != derived_layer_types:
mismatches = [
i
for i, (got, want) in enumerate(
zip(self.layer_types, derived_layer_types)
)
if got != want
]
raise ValueError(
"layer_types disagrees with no_rope_layers (NoPE layers "
"must be the full_attention layers) at layer indices "
f"{mismatches}"
)
if self.muse_glimmer_mlx_format is not None and (
self.muse_glimmer_mlx_format != MUSE_GLIMMER_MLX_FORMAT_VERSION
):
raise ValueError(
f"muse_glimmer_mlx_format {self.muse_glimmer_mlx_format} is not supported by "
f"this model file (expected {MUSE_GLIMMER_MLX_FORMAT_VERSION}); "
"regenerate the artifact with a matching packager"
)
class ScalelessRMSNorm(nn.Module):
"""RMS norm with no learnable scale (reference MuseGlimmerScalelessRMSNorm)."""
View on GitHub (pinned to 0132848349)
Solutions
- Drop layer_types (set to null) so it is derived from no_rope_layers, eliminating the inconsistency
- Or reconcile layer_types so every NoPE index maps to 'full_attention' and every RoPE index to 'sliding_attention'
- Regenerate the config from the original checkpoint metadata
Example fix
// before "no_rope_layers": [0, 1], "layer_types": ["sliding_attention", "sliding_attention"] // after "no_rope_layers": [0, 1], "layer_types": null
Defensive patterns
Strategy: validation
Validate before calling
derived = ["full_attention" if f == 0 else "sliding_attention" for f in cfg["no_rope_layers"]]
assert cfg.get("layer_types") in (None, derived) Type guard
def fields_agree(cfg: dict) -> bool:
derived = ["full_attention" if f == 0 else "sliding_attention" for f in cfg["no_rope_layers"]]
return cfg.get("layer_types") in (None, derived) Prevention
- Only specify one of the two fields; leave the other null
- Treat them as redundant encodings, never independent knobs
When it happens
Trigger: Supplying both no_rope_layers and a layer_types list that encode different layer assignments — e.g. layer 3 has no_rope_layers[3]==0 (NoPE ⇒ full_attention) but layer_types[3]=='sliding_attention'.
Common situations: Hand-editing one field but not the other, merging configs from two model revisions whose layer layouts changed, or misunderstanding that the two fields are redundant encodings of the same layout.
Related errors
- layer_types has {len(self.layer_types)} entries but num_hidd
- layer_types contains unknown entries {bad}; expected only 'f
- bad compress_ratio {compress_ratio}
- The requested FlashAttention forward configuration exceeds S
- flashinfer_sparse_mla supports only GLM DSA with FP8 KV cach
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/20b3951472fed61b.
Report an issue: GitHub.