{"record":{"id":"5ed9d5b15477ec2d","repo":"huggingface/candle","slug":"spectralnorm-is-not-supported-yet","errorCode":null,"errorMessage":"SpectralNorm is not supported yet.","messagePattern":"SpectralNorm is not supported yet\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-transformers/src/models/mimi/conv.rs","lineNumber":80,"sourceCode":"        k_size: usize,\n        causal: bool,\n        norm: Option<Norm>,\n        bias: bool,\n        cfg: candle_nn::Conv1dConfig,\n        vb: VarBuilder,\n    ) -> Result<Self> {\n        let conv = match norm {\n            None | Some(Norm::TimeGroupNorm) => {\n                if bias {\n                    candle_nn::conv1d(in_c, out_c, k_size, cfg, vb.pp(\"conv\"))?\n                } else {\n                    candle_nn::conv1d_no_bias(in_c, out_c, k_size, cfg, vb.pp(\"conv\"))?\n                }\n            }\n            Some(Norm::WeightNorm) => {\n                conv1d_weight_norm(in_c, out_c, k_size, bias, cfg, vb.pp(\"conv\"))?\n            }\n            Some(Norm::SpectralNorm) => candle::bail!(\"SpectralNorm is not supported yet.\"),\n        };\n        let norm = match norm {\n            None | Some(Norm::WeightNorm) | Some(Norm::SpectralNorm) => None,\n            Some(Norm::TimeGroupNorm) => {\n                if causal {\n                    candle::bail!(\"GroupNorm doesn't support causal evaluation.\")\n                }\n                let norm = candle_nn::group_norm(1, out_c, 1e-5, vb.pp(\"norm\"))?;\n                Some(norm)\n            }\n        };\n        Ok(Self {\n            conv,\n            norm,\n            span: tracing::span!(tracing::Level::TRACE, \"norm-conv1d\"),\n        })\n    }\n}","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-transformers/src/models/mimi/conv.rs#L62-L98","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nlet cfg = Conv1dConfig { norm: Some(Norm::SpectralNorm), .. };\n// after\nlet cfg = Conv1dConfig { norm: Some(Norm::WeightNorm), .. };","handlingStrategy":"validation","validationCode":"if cfg.norm == Some(Norm::SpectralNorm) {\n    return Err(\"candle mimi does not support SpectralNorm; use WeightNorm or None\");\n}","typeGuard":null,"tryCatchPattern":"let layer = Conv1d::new(in_c, out_c, k, cfg, causal, vb)\n    .map_err(|e| format!(\"unsupported norm: {e}\"))?;","preventionTips":["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"],"tags":["rust","candle","mimi","audio","unsupported-feature"],"backgroundTag":"unsupported-config-option","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}