Comfy-Org/ComfyUI · error · ValueError
Unknown activation type: {activation_type}
Error message
Unknown activation type: {activation_type} What it means
Factory guard in comfy/ldm/ace/vae/autoencoder_dc.py: get_activation() supports exactly relu, relu6, silu, and leaky_relu. Any other act_fn string from the model config raises ValueError at build time, before any weights load.
Source
Thrown at comfy/ldm/ace/vae/autoencoder_dc.py:49
elif norm_type == "layer_norm":
return ops.LayerNorm(num_features)
elif norm_type == "rms_norm":
return RMSNorm(num_features, eps=eps, elementwise_affine=True, bias=True)
else:
raise ValueError(f"Unknown normalization type: {norm_type}")
def get_activation(activation_type):
if activation_type == "relu":
return nn.ReLU()
elif activation_type == "relu6":
return nn.ReLU6()
elif activation_type == "silu":
return nn.SiLU()
elif activation_type == "leaky_relu":
return nn.LeakyReLU(0.2)
else:
raise ValueError(f"Unknown activation type: {activation_type}")
class ResBlock(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
norm_type: str = "batch_norm",
act_fn: str = "relu6",
) -> None:
super().__init__()
self.norm_type = norm_type
self.nonlinearity = get_activation(act_fn) if act_fn is not None else nn.Identity()
self.conv1 = ops.Conv2d(in_channels, in_channels, 3, 1, 1)
self.conv2 = ops.Conv2d(in_channels, out_channels, 3, 1, 1, bias=False)
self.norm = get_normalization(norm_type, out_channels)
View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Inspect the checkpoint config's act_fn values and correct them to one of relu|relu6|silu|leaky_relu
- Check for casing/whitespace issues in the config string and normalize it
- If the model truly requires another activation, extend get_activation in this fork rather than skipping the check
Example fix
# before (checkpoint config) "act_fn": "swish" # after "act_fn": "silu"
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_ACTS = {"relu", "relu6", "silu", "leaky_relu"}
if cfg.get('act_fn') not in SUPPORTED_ACTS:
raise SystemExit(f"unsupported act_fn {cfg.get('act_fn')}; supported: {SUPPORTED_ACTS}") Type guard
def is_supported_activation(name: str) -> bool:
return name in {"relu", "relu6", "silu", "leaky_relu"} Prevention
- Whitelist activation names at config load time
- Prefer re-using the upstream config untouched over editing activation strings
- Add config linting in custom loaders before model construction
When it happens
Trigger: Loading an AutoencoderDC whose config specifies an unsupported activation, e.g. 'gelu', 'Swish', 'silu ' (trailing space), or 'mish'. The act_fn is defined per-block in the checkpoint's architecture config (ResBlock default is relu6).
Common situations: Hand-edited or upstream-drifted ACE VAE configs; configs exported from a different codebase using different activation naming; typo in a custom fine-tune config.
Related errors
- activation incorrectly specified. check the config file and
- Unknown normalization type: {norm_type}
- Block with {block_type=} is not supported.
- Unknown activation function: {act_fn}
- Minimum cutoff must be larger than zero.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/5df818aec007a5d4.
Report an issue: GitHub.