Comfy-Org/ComfyUI · error · NotImplementedError

Temperature {temperature} is not supported.

Error message

Temperature {temperature} is not supported.

What it means

The genmo (Mochi) VAE's DiagonalGaussian posterior supports only three sampling modes: temperature 0.0 (deterministic mean), 1.0 (standard Gaussian sample), or a caller-supplied noise tensor with temperature 1.0 behavior. Any other temperature raises NotImplementedError because variance scaling for intermediate temperatures was not ported.

Source

Thrown at comfy/ldm/genmo/vae/model.py:555

            mean: Mean of the distribution. Shape: [B, C, T, H, W].
            logvar: Logarithm of variance of the distribution. Shape: [B, C, T, H, W].
        """
        assert mean.shape == logvar.shape
        self.mean = mean
        self.logvar = logvar

    def sample(self, temperature=1.0, generator: torch.Generator = None, noise=None):
        if temperature == 0.0:
            return self.mean

        if noise is None:
            noise = torch.randn(self.mean.shape, device=self.mean.device, dtype=self.mean.dtype, generator=generator)
        else:
            assert noise.device == self.mean.device
            noise = noise.to(self.mean.dtype)

        if temperature != 1.0:
            raise NotImplementedError(f"Temperature {temperature} is not supported.")

        # Just Gaussian sample with no scaling of variance.
        return noise * torch.exp(self.logvar * 0.5) + self.mean

    def mode(self):
        return self.mean

class Encoder(nn.Module):
    def __init__(
        self,
        *,
        in_channels: int,
        base_channels: int,
        channel_multipliers: List[int],
        num_res_blocks: List[int],
        latent_dim: int,
        temporal_reductions: List[int],
        spatial_reductions: List[int],

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Use temperature=1.0 for stochastic sampling or temperature=0.0 for the deterministic mean.
  2. If you need intermediate scaling, apply it yourself: z = posterior.sample(1.0); z = posterior.mean + temperature * (z - posterior.mean).
  3. Remove/avoid exposing a temperature control for this VAE in custom nodes.

Example fix

# before
z = posterior.sample(temperature=0.8)

# after
z = posterior.sample(temperature=1.0)
z = posterior.mean + 0.8 * (z - posterior.mean)  # manual temperature scaling
Defensive patterns

Strategy: validation

Validate before calling

assert temperature in (0.0, 1.0), f"genmo VAE sample supports temperature 0.0 or 1.0 only, got {temperature}"

Type guard

def is_supported_genmo_temperature(t: float) -> bool:
    return t in (0.0, 1.0)

Prevention

When it happens

Trigger: Calling posterior.sample(temperature=0.7) or any value other than 0.0/1.0 during VAE encode sampling; note temperature==0.0 returns early and the raise only fires for values strictly between or above.

Common situations: Porting sampling code from other VAE implementations that expose continuous temperature controls; custom nodes exposing a temperature slider for the Mochi VAE.

Related errors


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