{"record":{"id":"20b3951472fed61b","repo":"sgl-project/sglang","slug":"layer-types-disagrees-with-no-rope-layers-nope-la","errorCode":null,"errorMessage":"layer_types disagrees with no_rope_layers (NoPE layers must be the full_attention layers) at layer indices {mismatches}","messagePattern":"layer_types disagrees with no_rope_layers \\(NoPE layers must be the full_attention layers\\) at layer indices (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/hardware_backend/mlx/models/muse_glimmer_mlx.py","lineNumber":317,"sourceCode":"                    f\"num_hidden_layers is {self.num_hidden_layers}\"\n                )\n            bad = sorted(\n                set(self.layer_types) - {\"full_attention\", \"sliding_attention\"}\n            )\n            if bad:\n                raise ValueError(\n                    f\"layer_types contains unknown entries {bad}; expected only \"\n                    \"'full_attention' or 'sliding_attention'\"\n                )\n            if self.layer_types != derived_layer_types:\n                mismatches = [\n                    i\n                    for i, (got, want) in enumerate(\n                        zip(self.layer_types, derived_layer_types)\n                    )\n                    if got != want\n                ]\n                raise ValueError(\n                    \"layer_types disagrees with no_rope_layers (NoPE layers \"\n                    \"must be the full_attention layers) at layer indices \"\n                    f\"{mismatches}\"\n                )\n\n        if self.muse_glimmer_mlx_format is not None and (\n            self.muse_glimmer_mlx_format != MUSE_GLIMMER_MLX_FORMAT_VERSION\n        ):\n            raise ValueError(\n                f\"muse_glimmer_mlx_format {self.muse_glimmer_mlx_format} is not supported by \"\n                f\"this model file (expected {MUSE_GLIMMER_MLX_FORMAT_VERSION}); \"\n                \"regenerate the artifact with a matching packager\"\n            )\n\n\nclass ScalelessRMSNorm(nn.Module):\n    \"\"\"RMS norm with no learnable scale (reference MuseGlimmerScalelessRMSNorm).\"\"\"\n","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/hardware_backend/mlx/models/muse_glimmer_mlx.py#L299-L335","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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"],"exampleFix":"// before\n\"no_rope_layers\": [0, 1],\n\"layer_types\": [\"sliding_attention\", \"sliding_attention\"]\n// after\n\"no_rope_layers\": [0, 1],\n\"layer_types\": null","handlingStrategy":"validation","validationCode":"derived = [\"full_attention\" if f == 0 else \"sliding_attention\" for f in cfg[\"no_rope_layers\"]]\nassert cfg.get(\"layer_types\") in (None, derived)","typeGuard":"def fields_agree(cfg: dict) -> bool:\n    derived = [\"full_attention\" if f == 0 else \"sliding_attention\" for f in cfg[\"no_rope_layers\"]]\n    return cfg.get(\"layer_types\") in (None, derived)","tryCatchPattern":null,"preventionTips":["Only specify one of the two fields; leave the other null","Treat them as redundant encodings, never independent knobs"],"tags":["config-validation","consistency-check","layer-types"],"backgroundTag":"conflicting-config-fields","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}