Comfy-Org/ComfyUI · error · ValueError

causality is only supported when `with_conv=True`.

Error message

causality is only supported when `with_conv=True`.

What it means

Raised by Downsample.__init__ in the causal audio autoencoder when a causality_axis other than NONE is requested together with with_conv=False. Causal padding is implemented by manually padding before a strided conv; the avg-pool branch has no causal variant, so the combination is rejected.

Source

Thrown at comfy/ldm/lightricks/vae/causal_audio_autoencoder.py:266

                    raise ValueError(f"Invalid causality_axis: {self.causality_axis}")

        return x


class Downsample(nn.Module):
    """
    A downsampling layer that can use either a strided convolution
    or average pooling. Supports standard and causal padding for the
    convolutional mode.
    """

    def __init__(self, in_channels, with_conv, causality_axis: CausalityAxis = CausalityAxis.WIDTH):
        super().__init__()
        self.with_conv = with_conv
        self.causality_axis = causality_axis

        if self.causality_axis != CausalityAxis.NONE and not self.with_conv:
            raise ValueError("causality is only supported when `with_conv=True`.")

        if self.with_conv:
            # Do time downsampling here
            # no asymmetric padding in torch conv, must do it ourselves
            self.conv = ops.Conv2d(in_channels, in_channels, kernel_size=3, stride=2, padding=0)

    def forward(self, x):
        if self.with_conv:
            # (pad_left, pad_right, pad_top, pad_bottom)
            match self.causality_axis:
                case CausalityAxis.NONE:
                    pad = (0, 1, 0, 1)
                case CausalityAxis.WIDTH:
                    pad = (2, 0, 0, 1)
                case CausalityAxis.HEIGHT:
                    pad = (0, 1, 2, 0)
                case CausalityAxis.WIDTH_COMPATIBILITY:
                    pad = (1, 0, 0, 1)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Set with_conv=True so the causal strided-convolution path is used
  2. Or set causality_axis=CausalityAxis.NONE if causal behavior is not needed for this block
  3. Fix the Encoder/Decoder block config so with_conv=False blocks always carry a NONE axis

Example fix

# before
down = Downsample(ch, with_conv=False, causality_axis=CausalityAxis.WIDTH)

# after
down = Downsample(ch, with_conv=False, causality_axis=CausalityAxis.NONE)
Defensive patterns

Strategy: validation

Validate before calling

if not with_conv and causality_axis != CausalityAxis.NONE:
    causality_axis = CausalityAxis.NONE  # or raise your own error early
down = Downsample(ch, with_conv=with_conv, causality_axis=causality_axis)

Prevention

When it happens

Trigger: Instantiating Downsample(in_channels, with_conv=False, causality_axis=CausalityAxis.WIDTH) (or any non-NONE axis), including indirectly from an Encoder/Decoder config that pairs with_conv=False down blocks with a causal axis.

Common situations: Experimenting with lighter downsamplers (avg-pool) in a causal streaming audio VAE; config edits that flip with_conv without resetting causality_axis to NONE.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/d72932e667d7661d. Report an issue: GitHub.