{"record":{"id":"97797b39c5e85ad0","repo":"sgl-project/sglang","slug":"no-rope-layers-contains-non-binary-entries-bad-fl","errorCode":null,"errorMessage":"no_rope_layers contains non-binary entries {bad_flags}; each entry must be 0 (NoPE) or 1 (RoPE)","messagePattern":"no_rope_layers contains non-binary entries (.+?); each entry must be 0 \\(NoPE\\) or 1 \\(RoPE\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/hardware_backend/mlx/models/muse_glimmer_mlx.py","lineNumber":283,"sourceCode":"                f\"num_attention_heads ({self.num_attention_heads}) must be a \"\n                f\"multiple of num_key_value_heads ({self.num_key_value_heads})\"\n            )\n\n        derived_no_rope = [\n            0 if (self.num_hidden_layers - i - 1) % self.every_n_layers_nope == 0 else 1\n            for i in range(self.num_hidden_layers)\n        ]\n        if self.no_rope_layers is None:\n            self.no_rope_layers = derived_no_rope\n        else:\n            if len(self.no_rope_layers) != self.num_hidden_layers:\n                raise ValueError(\n                    f\"no_rope_layers has {len(self.no_rope_layers)} entries but \"\n                    f\"num_hidden_layers is {self.num_hidden_layers}\"\n                )\n            bad_flags = sorted(set(self.no_rope_layers) - {0, 1})\n            if bad_flags:\n                raise ValueError(\n                    f\"no_rope_layers contains non-binary entries {bad_flags}; \"\n                    \"each entry must be 0 (NoPE) or 1 (RoPE)\"\n                )\n\n        # NoPE layers are the full-attention layers; the rest slide.\n        derived_layer_types = [\n            \"full_attention\" if rope_flag == 0 else \"sliding_attention\"\n            for rope_flag in self.no_rope_layers\n        ]\n        if self.layer_types is None:\n            self.layer_types = derived_layer_types\n        else:\n            if len(self.layer_types) != self.num_hidden_layers:\n                raise ValueError(\n                    f\"layer_types has {len(self.layer_types)} entries but \"\n                    f\"num_hidden_layers is {self.num_hidden_layers}\"\n                )\n            bad = sorted(","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/hardware_backend/mlx/models/muse_glimmer_mlx.py#L265-L301","documentation":"The Muse Glimmer MLX config's no_rope_layers field must be a binary list where each entry is 0 (NoPE / no positional embedding) or 1 (RoPE). The post-init validator computes the set difference between the provided flags and {0,1} and throws if any non-binary values (e.g. 2, True/False mixed with ints is fine, but strings, None, or >1) are present.","triggerScenarios":"Constructing the config dataclass (its __post_init__ runs automatically) with no_rope_layers containing values other than 0 or 1 — e.g. [0,1,2,...], ['0','1'], or booleans-as-strings loaded from a malformed config.json or hand-edited YAML.","commonSituations":"Hand-editing config.json and introducing typos, loading a config produced by a different/older packager that emitted layer-type strings or trinary flags, or programmatically deriving no_rope_layers from a formula that yields out-of-range values.","solutions":["Inspect self.no_rope_layers and normalize every entry to int(v) if booleans/strings were intended","Fix the upstream config.json so every entry is exactly 0 or 1","Regenerate the artifact with the matching packager if the config came from a mismatched toolchain"],"exampleFix":"// before\n\"no_rope_layers\": [0, 1, 2, 1]\n// after\n\"no_rope_layers\": [0, 1, 1, 1]","handlingStrategy":"validation","validationCode":"flags = cfg.get(\"no_rope_layers\", [])\nassert all(v in (0, 1) for v in flags), f\"non-binary entries: {sorted(set(flags) - {0,1})}\"","typeGuard":"def is_binary_layer_flags(v) -> bool:\n    return isinstance(v, list) and all(x in (0, 1) for x in v)","tryCatchPattern":null,"preventionTips":["Normalize no_rope_layers entries to ints right after loading config","Never hand-edit the list; derive it from the model card metadata"],"tags":["config-validation","mlx","rope","muse-glimmer"],"backgroundTag":"config-field-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}