huggingface/candle · error
only TorchAttn is supported
Error message
only TorchAttn is supported
What it means
SelfAttention::new in the metavoice model only implements the TorchAttn attention kernel; any other attn_kernel_type in the model Config causes this bail. The comment notes the other variants (like FusedAttn) are probably identical but are intentionally rejected until verified. This is an explicit unsupported-feature guard.
Source
Thrown at candle-transformers/src/models/metavoice.rs:446
Self::LayerNorm(m) => m.forward(xs),
}
}
}
// https://github.com/metavoiceio/metavoice-src/blob/11550bb4e8a1ad032cc1556cc924f7a4e767cbfa/fam/llm/layers/attn.py#L18
struct SelfAttention {
c_attn: Linear,
c_proj: Linear,
n_head: usize,
span: tracing::Span,
}
impl SelfAttention {
fn new(cfg: &Config, vb: VarBuilder) -> Result<Self> {
// The different attention variants are likely to be identical but still we only accept
// TorchAttn for now.
if cfg.attn_kernel_type != AttnKernelType::TorchAttn {
candle::bail!("only TorchAttn is supported")
}
if cfg.kv_cache_enabled {
candle::bail!("kv_cache_enabled=true is not supported")
}
let c_attn = linear_b(cfg.n_embd, cfg.n_embd * 3, cfg.bias, vb.pp("c_attn"))?;
let c_proj = linear_b(cfg.n_embd, cfg.n_embd, cfg.bias, vb.pp("c_proj"))?;
Ok(Self {
c_attn,
c_proj,
n_head: cfg.n_head,
span: tracing::span!(tracing::Level::TRACE, "self-attn"),
})
}
}
impl Module for SelfAttention {
fn forward(&self, xs: &Tensor) -> Result<Tensor> {
let _enter = self.span.enter();View on GitHub (pinned to d5fee525bf)
Solutions
- Set attn_kernel_type to AttnKernelType::TorchAttn in the Config (or in the source config file) before building the model
- Use a checkpoint/config that was exported with the TorchAttn kernel
- Patch SelfAttention::new to implement (or verify) the other kernel if you truly need it
Example fix
// before
let cfg = Config { attn_kernel_type: AttnKernelType::FusedAttn, .. };
// after
let cfg = Config { attn_kernel_type: AttnKernelType::TorchAttn, .. }; Defensive patterns
Strategy: validation
Validate before calling
if cfg.attn_kernel_type != AttnKernelType::TorchAttn {
return Err("metavoice in candle requires attn_kernel_type = TorchAttn");
} Try / catch
let model = Metavoice::new(&cfg, vb)
.map_err(|e| format!("unsupported attention kernel: {e}"))?; Prevention
- Pin attn_kernel_type to TorchAttn in your Config
- Check checkpoint config.json for non-TorchAttn kernels before loading in candle
- Keep to officially exported MetaVoice checkpoints
When it happens
Trigger: Constructing the MetaVoice self-attention layer with a Config parsed from a checkpoint whose config.json sets attn_kernel_type to anything other than "TORCH_ATTN" (e.g. FAVA, or another kernel variant).
Common situations: Loading a MetaVoice variant exported with different attention kernels; a converted config that preserves the original kernel type; hand-writing a Config with a non-default attn_kernel_type.
Related errors
- kv_cache_enabled=true is not supported
- swiglu-multiple-of has to be set
- sliding window is not supported
- Unsupported activation function: {}
- Unsupported projector activation: {}
AI-assisted analysis of huggingface/candle@d5fee525bf (2026-09-02).
Data as JSON: /api/errors/2185ad43fc3a4688.
Report an issue: GitHub.