huggingface/candle · error
SpectralNorm is not supported yet.
Error message
SpectralNorm is not supported yet.
What it means
The Mimi conv1d layer supports no normalization, WeightNorm, and TimeGroupNorm, but SpectralNorm is not implemented in candle. When the conv config requests SpectralNorm, new bails immediately. This is an explicit unsupported-feature guard during model construction.
Source
Thrown at candle-transformers/src/models/mimi/conv.rs:80
k_size: usize,
causal: bool,
norm: Option<Norm>,
bias: bool,
cfg: candle_nn::Conv1dConfig,
vb: VarBuilder,
) -> Result<Self> {
let conv = match norm {
None | Some(Norm::TimeGroupNorm) => {
if bias {
candle_nn::conv1d(in_c, out_c, k_size, cfg, vb.pp("conv"))?
} else {
candle_nn::conv1d_no_bias(in_c, out_c, k_size, cfg, vb.pp("conv"))?
}
}
Some(Norm::WeightNorm) => {
conv1d_weight_norm(in_c, out_c, k_size, bias, cfg, vb.pp("conv"))?
}
Some(Norm::SpectralNorm) => candle::bail!("SpectralNorm is not supported yet."),
};
let norm = match norm {
None | Some(Norm::WeightNorm) | Some(Norm::SpectralNorm) => None,
Some(Norm::TimeGroupNorm) => {
if causal {
candle::bail!("GroupNorm doesn't support causal evaluation.")
}
let norm = candle_nn::group_norm(1, out_c, 1e-5, vb.pp("norm"))?;
Some(norm)
}
};
Ok(Self {
conv,
norm,
span: tracing::span!(tracing::Level::TRACE, "norm-conv1d"),
})
}
}View on GitHub (pinned to d5fee525bf)
Solutions
- Use a Mimi checkpoint whose conv layers use weight norm (the standard Mimi weights) instead of spectral norm
- Change the norm field in the conv config to Norm::WeightNorm or None if your source model allows it
- Implement spectral normalization in candle (power iteration on the weight) before enabling this path
Example fix
// before
let cfg = Conv1dConfig { norm: Some(Norm::SpectralNorm), .. };
// after
let cfg = Conv1dConfig { norm: Some(Norm::WeightNorm), .. }; Defensive patterns
Strategy: validation
Validate before calling
if cfg.norm == Some(Norm::SpectralNorm) {
return Err("candle mimi does not support SpectralNorm; use WeightNorm or None");
} Try / catch
let layer = Conv1d::new(in_c, out_c, k, cfg, causal, vb)
.map_err(|e| format!("unsupported norm: {e}"))?; Prevention
- Verify checkpoint norm types before loading (spectral norm is unimplemented)
- Prefer the standard Mimi weights, which use weight norm
- Normalize configs to supported variants when converting from PyTorch
When it happens
Trigger: Constructing a Mimi conv1d layer (Conv1d::new) from a config whose norm field is Some(Norm::SpectralNorm), typically loaded from a Mimi checkpoint/ops config that specifies spectral normalization.
Common situations: Loading a Mimi/EnCodec-style codec checkpoint that used spectral norm in some layers; converting models that rely on spectral norm; reusing configs from PyTorch implementations where spectral norm is available.
Related errors
- pad-mode 'reflect' is not supported
- GroupNorm doesn't support causal evaluation.
- seanet lstm is not supported
- only TorchAttn is supported
- kv_cache_enabled=true is not supported
AI-assisted analysis of huggingface/candle@d5fee525bf (2026-09-02).
Data as JSON: /api/errors/5ed9d5b15477ec2d.
Report an issue: GitHub.