{"record":{"id":"430bd770b200b73c","repo":"sgl-project/sglang","slug":"unsupported-spark2-5-layer-type-layer-type","errorCode":null,"errorMessage":"Unsupported Spark2_5 layer_type: {layer_type}","messagePattern":"Unsupported Spark2_5 layer_type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/models/spark2_5.py","lineNumber":172,"sourceCode":"            hidden_size,\n            bias=False,\n            quant_config=quant_config,\n            tp_rank=attn_tp_rank,\n            tp_size=attn_tp_size,\n            prefix=add_prefix(\"out_proj\", prefix),\n        )\n\n        self.rotary_emb = get_rope(\n            self.head_dim,\n            rotary_dim=self.head_dim,\n            max_position=max_position_embeddings,\n            base=rope_theta,\n            rope_scaling=None,\n            partial_rotary_factor=partial_rotary_factor,\n            is_neox_style=True,\n        )\n        if layer_type not in (\"sliding_attention\", \"full_attention\"):\n            raise ValueError(f\"Unsupported Spark2_5 layer_type: {layer_type}\")\n        sliding_window_size = (\n            sliding_window if layer_type == \"sliding_attention\" else -1\n        )\n        self.attn = RadixAttention(\n            self.num_heads,\n            self.head_dim,\n            self.scaling,\n            num_kv_heads=self.num_kv_heads,\n            sliding_window_size=sliding_window_size,\n            layer_id=layer_id,\n            quant_config=quant_config,\n            prefix=add_prefix(\"attn\", prefix),\n        )\n\n    def forward(\n        self,\n        positions: torch.Tensor,\n        hidden_states: torch.Tensor,","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/spark2_5.py#L154-L190","documentation":"Spark2_5 attention layers must be typed 'sliding_attention' or 'full_attention'; anything else in the layer's config raises at init. The type decides whether RadixAttention gets the sliding window or full attention.","triggerScenarios":"A layer entry in the Spark2.5 checkpoint whose layer_type string is neither of the two supported values (typo, new interleaving scheme, or malformed config.json).","commonSituations":"Newer Spark2.5 checkpoints introducing new layer types on an older sglang; hand-edited or merged config.json corrupting layer_type arrays.","solutions":["Update sglang to a release supporting the checkpoint's layer scheme","Inspect config.json layer_types array and fix invalid entries to sliding_attention/full_attention","If it's a genuinely new type, patch the check in spark2_5.py to handle it (mapping to an appropriate window)"],"exampleFix":"// config.json\n// before: \"layer_types\": [\"sliding\", \"full_attention\"]\n// after:  \"layer_types\": [\"sliding_attention\", \"full_attention\"]","handlingStrategy":"validation","validationCode":"valid = {\"sliding_attention\", \"full_attention\"}\nassert set(config.layer_types) <= valid, set(config.layer_types) - valid","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Sanity-check layer_types after any config merge or conversion"],"tags":["spark2-5","layer-type","config"],"backgroundTag":"unsupported-layer-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}