{"record":{"id":"079357af79d6fc83","repo":"sgl-project/sglang","slug":"missing-config-sliding-window-for-mellum-sliding-a","errorCode":null,"errorMessage":"Missing config.sliding_window for Mellum sliding_attention layer {layer_id}","messagePattern":"Missing config\\.sliding_window for Mellum sliding_attention layer (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/models/mellum.py","lineNumber":368,"sourceCode":"        if layer_type not in (\"sliding_attention\", \"full_attention\"):\n            raise ValueError(\n                f\"Unsupported layer_types[{layer_id}]={layer_type}; \"\n                \"expected 'sliding_attention' or 'full_attention'\"\n            )\n\n        rope_parameters = cfg.rope_parameters\n        rope_params = rope_parameters.get(layer_type)\n        if rope_params is None:\n            raise ValueError(\n                f\"Missing rope_parameters[{layer_type}] for Mellum layer {layer_id}\"\n            )\n\n        # Mellum routes SWA per-layer via layer_types. Preserve the configured\n        # window regardless of legacy use_sliding_window post-init side effects.\n        if layer_type == \"sliding_attention\":\n            sliding_window_size = get_attention_sliding_window_size(config)\n            if sliding_window_size is None:\n                raise ValueError(\n                    \"Missing config.sliding_window for Mellum \"\n                    f\"sliding_attention layer {layer_id}\"\n                )\n        else:\n            sliding_window_size = -1\n\n        max_position_embeddings = cfg.max_position_embeddings\n        head_dim = cfg.head_dim\n        rms_norm_eps = cfg.rms_norm_eps\n        attention_bias = cfg.attention_bias\n\n        self.self_attn = MellumAttention(\n            hidden_size=self.hidden_size,\n            num_heads=cfg.num_attention_heads,\n            num_kv_heads=cfg.num_key_value_heads,\n            layer_id=layer_id,\n            start_layer=start_layer,\n            rope_params=rope_params,","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/mellum.py#L350-L386","documentation":"Mellum routes sliding-window attention per layer via config.layer_types; when a layer is 'sliding_attention' the model reads the window size from config.sliding_window. If that field is absent (None), the model cannot size the attention window and raises. It intentionally ignores legacy use_sliding_window post-init side effects.","triggerScenarios":"Loading a Mellum config where layer_types contains 'sliding_attention' but sliding_window is null/missing in config.json; converting a checkpoint that stored the window under a different key (e.g. sliding_window in rope_parameters or per-layer overrides).","commonSituations":"Hand-written or stripped config.json during conversion; HF configs where sliding_window was set to None post-init; mixing config files across Mellum revisions.","solutions":["Set an integer config.sliding_window in config.json (e.g. 8192) matching the checkpoint's window","Verify no post-init code sets use_sliding_window=False and nulls sliding_window before the model builds","If the checkpoint truly has no SWA, change that layer's layer_types entry to 'full_attention'"],"exampleFix":"// before\n\"layer_types\": [\"sliding_attention\"], \"sliding_window\": null\n// after\n\"layer_types\": [\"sliding_attention\"], \"sliding_window\": 8192","handlingStrategy":"validation","validationCode":"cfg = AutoConfig.from_pretrained(path)\nif \"sliding_attention\" in (cfg.layer_types or []):\n    assert getattr(cfg, \"sliding_window\", None), \"config.sliding_window must be set for SWA layers\"","typeGuard":"def swa_config_ok(cfg) -> bool:\n    return \"sliding_attention\" not in (cfg.layer_types or []) or isinstance(getattr(cfg, \"sliding_window\", None), int)","tryCatchPattern":null,"preventionTips":["Never null out sliding_window when editing configs","Diff your config against the released Mellum config.json"],"tags":["mellum","sliding-window","config-validation"],"backgroundTag":"missing-config-field","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}