{"record":{"id":"179020bd5e086c43","repo":"huggingface/candle","slug":"groupnorm-doesn-t-support-causal-evaluation","errorCode":null,"errorMessage":"GroupNorm doesn't support causal evaluation.","messagePattern":"GroupNorm doesn't support causal evaluation\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"candle-transformers/src/models/mimi/conv.rs","lineNumber":86,"sourceCode":"    ) -> 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}\n\nimpl Module for NormConv1d {\n    fn forward(&self, xs: &Tensor) -> Result<Tensor> {\n        let _enter = self.span.enter();\n        let xs = xs.apply(&self.conv)?;\n        match self.norm.as_ref() {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/huggingface/candle/blob/d5fee525bfde3273eb7c9b75fd2bc4937be867ca/candle-transformers/src/models/mimi/conv.rs#L68-L104","documentation":"In Mimi's conv1d, TimeGroupNorm cannot be applied to causally-evaluated convolutions, so new bails when causal is true and norm is TimeGroupNorm. GroupNorm mixes statistics across the time dimension of the output, which is incompatible with causal (streaming) evaluation in this implementation.","triggerScenarios":"Constructing a causal Mimi Conv1d layer with cfg.norm = Some(Norm::TimeGroupNorm) — i.e. causal=true in the layer config plus time group norm.","commonSituations":"Streaming/real-time Mimi inference configs that set causal=true while the source checkpoint still specifies TimeGroupNorm on conv blocks; hand-building configs mixing causal mode with the checkpoint's norm settings.","solutions":["Set the conv layer's norm to None (or WeightNorm) when causal evaluation is required","Set causal=false if your use case permits non-streaming inference and the checkpoint needs TimeGroupNorm","Verify the config against the official Mimi setup, where causal convs pair with weight norm, not group norm"],"exampleFix":"// before\nlet cfg = Conv1dConfig { causal: true, norm: Some(Norm::TimeGroupNorm), .. };\n// after\nlet cfg = Conv1dConfig { causal: true, norm: None, .. };","handlingStrategy":"validation","validationCode":"if causal && cfg.norm == Some(Norm::TimeGroupNorm) {\n    return Err(\"TimeGroupNorm is incompatible with causal evaluation\");\n}","typeGuard":null,"tryCatchPattern":"let layer = Conv1d::new(in_c, out_c, k, cfg, causal, vb)\n    .map_err(|e| format!(\"invalid causal/norm combination: {e}\"))?;","preventionTips":["Use norm=None or WeightNorm for causal (streaming) layers","Keep causal and norm settings consistent with the official Mimi streaming config","Test streaming mode early to surface config incompatibilities"],"tags":["rust","candle","mimi","audio","streaming","incompatible-config"],"backgroundTag":"unsupported-config-option","analyzedSha":"d5fee525bfde3273eb7c9b75fd2bc4937be867ca","analyzedAt":"2026-09-02T00:15:47.023Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}