huggingface/candle · error
sliding window is not supported
Error message
sliding window is not supported
What it means
SmolLM3 attention layers reject model configurations that enable sliding-window attention. The candle implementation of SmolLM3 only implements global (full) attention, so when cfg.use_sliding_window is true (or Some(true)) it aborts construction of the attention layer via candle::bail!. This is an explicit unsupported-feature guard, not an unexpected failure.
Source
Thrown at candle-transformers/src/models/smol/smollm3.rs:174
head_dim: usize,
hidden_size: usize,
// utils
rotary_emb: Option<Arc<SmolLM3RotaryEmbedding>>,
kv_cache: KvCache,
// NoPE flag
skip_rope: bool,
}
impl SmolLM3Attention {
pub(crate) fn new(
cfg: &Config,
layer_idx: usize,
rotary_emb: Option<Arc<SmolLM3RotaryEmbedding>>,
vb: VarBuilder,
) -> Result<Self> {
let use_sliding_window = cfg.use_sliding_window.unwrap_or(false);
if use_sliding_window {
candle::bail!("sliding window is not supported")
}
let head_dim = cfg.head_dim();
let num_heads = cfg.num_attention_heads;
let num_kv_heads = cfg.num_key_value_heads;
let num_kv_groups = num_heads / num_kv_heads;
let attention_bias = cfg.attention_bias.unwrap_or(false);
let q_proj = linear_b(
cfg.hidden_size,
num_heads * head_dim,
attention_bias,
vb.pp("q_proj"),
)?;
let k_proj = linear_b(
cfg.hidden_size,View on GitHub (pinned to d5fee525bf)
Solutions
- Set use_sliding_window to false (or remove it / set it to null) in the SmolLM3Config before constructing the model
- Check whether a newer candle version has added sliding-window support for SmolLM3 and upgrade
- Use a model checkpoint that does not rely on sliding-window attention
Example fix
// before
let cfg = SmolLM3Config { use_sliding_window: Some(true), .. };
// after
let cfg = SmolLM3Config { use_sliding_window: Some(false), .. }; Defensive patterns
Strategy: validation
Validate before calling
if cfg.use_sliding_window.unwrap_or(false) {
return Err(anyhow::anyhow!("SmolLM3 sliding window unsupported; disable use_sliding_window"));
} Try / catch
match SmolLM3Model::new(&cfg, vb) {
Ok(m) => m,
Err(e) if e.to_string().contains("sliding window is not supported") => {
let mut cfg = cfg.clone(); cfg.use_sliding_window = Some(false);
SmolLM3Model::new(&cfg, vb)?
}
Err(e) => return Err(e.into()),
} Prevention
- Always normalize use_sliding_window to false for SmolLM3 in candle
- Sanitize HF config.json fields before mapping them into SmolLM3Config
- Pin a candle version and check its SmolLM3 feature support before loading new checkpoints
When it happens
Trigger: Calling SmolLM3Attention::new (during model load) with a SmolLM3Config whose use_sliding_window field is Some(true), e.g. loading a checkpoint/config.json that specifies sliding-window attention.
Common situations: Loading a SmolLM3 variant released with sliding-window attention enabled in its HF config; hand-editing config.json to enable use_sliding_window; using a config ported from transformers where the flag defaults on for certain layers.
Related errors
- only TorchAttn is supported
- kv_cache_enabled=true is not supported
- SpectralNorm is not supported yet.
- pad-mode 'reflect' is not supported
- sliding window is not supported
AI-assisted analysis of huggingface/candle@d5fee525bf (2026-09-02).
Data as JSON: /api/errors/2f9cbbea5866fc72.
Report an issue: GitHub.