sgl-project/sglang · critical · ValueError
Missing config.sliding_window for Mellum sliding_attention l
Error message
Missing config.sliding_window for Mellum sliding_attention layer {layer_id} What it means
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.
Source
Thrown at python/sglang/srt/models/mellum.py:368
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
attention_bias = cfg.attention_bias
self.self_attn = MellumAttention(
hidden_size=self.hidden_size,
num_heads=cfg.num_attention_heads,
num_kv_heads=cfg.num_key_value_heads,
layer_id=layer_id,
start_layer=start_layer,
rope_params=rope_params,View on GitHub (pinned to 0132848349)
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'
Example fix
// before "layer_types": ["sliding_attention"], "sliding_window": null // after "layer_types": ["sliding_attention"], "sliding_window": 8192
Defensive patterns
Strategy: validation
Validate before calling
cfg = AutoConfig.from_pretrained(path)
if "sliding_attention" in (cfg.layer_types or []):
assert getattr(cfg, "sliding_window", None), "config.sliding_window must be set for SWA layers" Type guard
def swa_config_ok(cfg) -> bool:
return "sliding_attention" not in (cfg.layer_types or []) or isinstance(getattr(cfg, "sliding_window", None), int) Prevention
- Never null out sliding_window when editing configs
- Diff your config against the released Mellum config.json
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Missing rope_parameters[{layer_type}] for Mellum layer {laye
- Expected len(mlp_layer_types) == num_hidden_layers, got {len
- Unsupported mlp_layer_types[{lid}]={mlp_type}; expected 'spa
- Sparse MLP requested but num_experts <= 0 in Mellum config
- bad compress_ratio {compress_ratio}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/079357af79d6fc83.
Report an issue: GitHub.