{"record":{"id":"bf14030cca647c46","repo":"sgl-project/sglang","slug":"missing-rope-parameters-layer-type-for-mellum-l","errorCode":null,"errorMessage":"Missing rope_parameters[{layer_type}] for Mellum layer {layer_id}","messagePattern":"Missing rope_parameters\\[(.+?)\\] for Mellum layer (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/models/mellum.py","lineNumber":359,"sourceCode":"        self.layer_id = layer_id\n\n        layer_types = cfg.layer_types\n        if len(layer_types) != cfg.num_hidden_layers:\n            raise ValueError(\n                \"Expected len(layer_types) == num_hidden_layers, got \"\n                f\"{len(layer_types)} and {cfg.num_hidden_layers}\"\n            )\n        layer_type = layer_types[layer_id]\n        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","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/mellum.py#L341-L377","documentation":"Mellum model initialization builds each decoder layer by looking up rope parameters for that layer's type (e.g. 'sliding_attention' or 'full_attention') in config.rope_parameters. If the config dict has no entry for that layer_type, the model refuses to build. This is a model-config validation error, not a runtime serving error.","triggerScenarios":"Loading a Mellum checkpoint whose config.json lacks rope_parameters (or lacks the key for a layer_type appearing in config.layer_types). Constructing MellumForCausalLM / its decoder layers with a hand-edited or HF-converted config where rope_parameters was dropped or renamed.","commonSituations":"Converting/fine-tuning Mellum with a config.json that omits rope_parameters; using a partial checkpoint or a config from a different Mellum revision; custom layer_types values not matching rope_parameters keys.","solutions":["Check config.json has rope_parameters with keys for every value in layer_types (typically 'sliding_attention' and 'full_attention')","Add the missing entry, e.g. \"rope_parameters\": {\"full_attention\": {\"rope_type\": \"default\", \"factor\": 1.0, ...}}","If converting from HF, regenerate the config from the original checkpoint instead of hand-editing"],"exampleFix":"// before\n\"layer_types\": [\"sliding_attention\", \"full_attention\"],\n\"rope_parameters\": {\"full_attention\": {\"rope_type\": \"default\"}}\n// after\n\"layer_types\": [\"sliding_attention\", \"full_attention\"],\n\"rope_parameters\": {\n  \"sliding_attention\": {\"rope_type\": \"default\", \"factor\": 1.0},\n  \"full_attention\": {\"rope_type\": \"default\", \"factor\": 1.0}\n}","handlingStrategy":"validation","validationCode":"cfg = AutoConfig.from_pretrained(path)\nlt = set(cfg.layer_types or [])\nmissing = lt - set((cfg.rope_parameters or {}).keys())\nassert not missing, f\"rope_parameters missing for: {missing}\"","typeGuard":"def has_rope_params(cfg) -> bool:\n    rp = getattr(cfg, \"rope_parameters\", None) or {}\n    return all(t in rp for t in set(cfg.layer_types or []))","tryCatchPattern":null,"preventionTips":["Validate config.json against the checkpoint's original config before launch","Add a CI check that layer_types entries are all covered by rope_parameters"],"tags":["mellum","config-validation","rope","model-loading"],"backgroundTag":"missing-config-field","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}