huggingface/candle · error

seanet lstm is not supported

Error message

seanet lstm is not supported

What it means

SeaNetEncoder::new in the mimi model refuses to build when the codec config requests LSTM layers (cfg.lstm > 0). The candle mimi implementation only implements the convolutional SeaNet blocks, so any config with an LSTM tail is rejected up front with this bail!.

Source

Thrown at candle-transformers/src/models/mimi/seanet.rs:162

#[derive(Debug, Clone)]
struct EncoderLayer {
    residuals: Vec<SeaNetResnetBlock>,
    downsample: StreamableConv1d,
}

#[derive(Debug, Clone)]
pub struct SeaNetEncoder {
    init_conv1d: StreamableConv1d,
    activation: candle_nn::Activation,
    layers: Vec<EncoderLayer>,
    final_conv1d: StreamableConv1d,
    span: tracing::Span,
}

impl SeaNetEncoder {
    pub fn new(cfg: &Config, vb: VarBuilder) -> Result<Self> {
        if cfg.lstm > 0 {
            candle::bail!("seanet lstm is not supported")
        }
        let n_blocks = 2 + cfg.ratios.len();
        let mut mult = 1usize;
        let init_norm = if cfg.disable_norm_outer_blocks >= 1 {
            None
        } else {
            Some(cfg.norm)
        };
        let mut layer_idx = 0;
        let vb = vb.pp("layers");
        let init_conv1d = StreamableConv1d::new(
            cfg.channels,
            mult * cfg.n_filters,
            cfg.kernel_size,
            /* stride */ 1,
            /* dilation */ 1,
            /* groups */ 1,
            /* bias */ true,

View on GitHub (pinned to d5fee525bf)

Solutions

  1. Set lstm to 0 in the mimi Config before constructing SeaNetEncoder
  2. Use a mimi checkpoint whose config disables the LSTM tail (conv-only variant)
  3. If LSTM support is required, implement the SeaNet LSTM blocks upstream or use a runtime that supports them

Example fix

// before
let cfg = Config { lstm: 2, ..base_cfg };
let encoder = SeaNetEncoder::new(&cfg, vb)?; // panics/bails
// after
let cfg = Config { lstm: 0, ..base_cfg };
let encoder = SeaNetEncoder::new(&cfg, vb)?;
Defensive patterns

Strategy: validation

Validate before calling

if cfg.lstm > 0 {
    return Err(anyhow::anyhow!("config requires seanet lstm which candle mimi does not support; set lstm = 0"));
}
let encoder = SeaNetEncoder::new(&cfg, vb)?;

Type guard

fn supports_seanet(cfg: &Config) -> bool { cfg.lstm == 0 }

Try / catch

let encoder = match SeaNetEncoder::new(&cfg, vb) {
    Ok(e) => e,
    Err(e) if e.to_string().contains("seanet lstm is not supported") => {
        return Err(anyhow::anyhow!("disable lstm in the mimi config"))
    }
    Err(e) => return Err(e.into()),
};

Prevention

When it happens

Trigger: Calling SeaNetEncoder::new (directly or via mimi encoder construction) with a Config whose lstm field is greater than 0, e.g. loading mimi checkpoints/configs derived from Moshi variants that enable the LSTM tail.

Common situations: Porting an official Moshi/mimi config JSON that has "lstm": 2; using a pretrained checkpoint variant that candle does not implement; copy-pasting a config from the original Kyutai/MLX codebase.

Related errors


AI-assisted analysis of huggingface/candle@d5fee525bf (2026-09-02). Data as JSON: /api/errors/5ff86a8673f24df2. Report an issue: GitHub.