sgl-project/sglang · critical · ValueError

Missing rope_parameters[{layer_type}] for Mellum layer {laye

Error message

Missing rope_parameters[{layer_type}] for Mellum layer {layer_id}

What it means

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.

Source

Thrown at python/sglang/srt/models/mellum.py:359

        self.layer_id = layer_id

        layer_types = cfg.layer_types
        if len(layer_types) != cfg.num_hidden_layers:
            raise ValueError(
                "Expected len(layer_types) == num_hidden_layers, got "
                f"{len(layer_types)} and {cfg.num_hidden_layers}"
            )
        layer_type = layer_types[layer_id]
        if layer_type not in ("sliding_attention", "full_attention"):
            raise ValueError(
                f"Unsupported layer_types[{layer_id}]={layer_type}; "
                "expected 'sliding_attention' or 'full_attention'"
            )

        rope_parameters = cfg.rope_parameters
        rope_params = rope_parameters.get(layer_type)
        if rope_params is None:
            raise ValueError(
                f"Missing rope_parameters[{layer_type}] for Mellum layer {layer_id}"
            )

        # Mellum routes SWA per-layer via layer_types. Preserve the configured
        # window regardless of legacy use_sliding_window post-init side effects.
        if layer_type == "sliding_attention":
            sliding_window_size = get_attention_sliding_window_size(config)
            if sliding_window_size is None:
                raise ValueError(
                    "Missing config.sliding_window for Mellum "
                    f"sliding_attention layer {layer_id}"
                )
        else:
            sliding_window_size = -1

        max_position_embeddings = cfg.max_position_embeddings
        head_dim = cfg.head_dim
        rms_norm_eps = cfg.rms_norm_eps

View on GitHub (pinned to 0132848349)

Solutions

  1. Check config.json has rope_parameters with keys for every value in layer_types (typically 'sliding_attention' and 'full_attention')
  2. Add the missing entry, e.g. "rope_parameters": {"full_attention": {"rope_type": "default", "factor": 1.0, ...}}
  3. If converting from HF, regenerate the config from the original checkpoint instead of hand-editing

Example fix

// before
"layer_types": ["sliding_attention", "full_attention"],
"rope_parameters": {"full_attention": {"rope_type": "default"}}
// after
"layer_types": ["sliding_attention", "full_attention"],
"rope_parameters": {
  "sliding_attention": {"rope_type": "default", "factor": 1.0},
  "full_attention": {"rope_type": "default", "factor": 1.0}
}
Defensive patterns

Strategy: validation

Validate before calling

cfg = AutoConfig.from_pretrained(path)
lt = set(cfg.layer_types or [])
missing = lt - set((cfg.rope_parameters or {}).keys())
assert not missing, f"rope_parameters missing for: {missing}"

Type guard

def has_rope_params(cfg) -> bool:
    rp = getattr(cfg, "rope_parameters", None) or {}
    return all(t in rp for t in set(cfg.layer_types or []))

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/bf14030cca647c46. Report an issue: GitHub.