lllyasviel/Fooocus · error · ValueError
Wrong activation value in EqualLinear: {activation}Supported
Error message
Wrong activation value in EqualLinear: {activation}Supported ones are: ['fused_lrelu', None]. What it means
Identical guard to the one in stylegan2_arch.py, but in the bilinear-backbone variant ldm_patched/pfn/architecture/face/stylegan2_bilinear_arch.py. This EqualLinear only supports activation=None or 'fused_lrelu' because the bilinear variant replaces fused up/down sampling and thus has no other fused activation paths. Any other activation string raises ValueError at construction.
Source
Thrown at ldm_patched/pfn/architecture/face/stylegan2_bilinear_arch.py:52
Supported: 'fused_lrelu', None. Default: None.
"""
def __init__(
self,
in_channels,
out_channels,
bias=True,
bias_init_val=0,
lr_mul=1,
activation=None,
):
super(EqualLinear, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.lr_mul = lr_mul
self.activation = activation
if self.activation not in ["fused_lrelu", None]:
raise ValueError(
f"Wrong activation value in EqualLinear: {activation}"
"Supported ones are: ['fused_lrelu', None]."
)
self.scale = (1 / math.sqrt(in_channels)) * lr_mul
self.weight = nn.Parameter(torch.randn(out_channels, in_channels).div_(lr_mul))
if bias:
self.bias = nn.Parameter(torch.zeros(out_channels).fill_(bias_init_val))
else:
self.register_parameter("bias", None)
def forward(self, x):
if self.bias is None:
bias = None
else:
bias = self.bias * self.lr_mul
if self.activation == "fused_lrelu":
out = F.linear(x, self.weight * self.scale)View on GitHub (pinned to ae05379cc9)
Solutions
- Pass activation=None or 'fused_lrelu'.
- If you patched stylegan2_arch.py to support a new activation, apply the matching patch to stylegan2_bilinear_arch.py (and vice versa) so the two vendored copies stay consistent.
- Apply custom activations outside EqualLinear in the caller's forward().
Example fix
// before EqualLinear(num_style_feat, in_channels, activation='relu') // after EqualLinear(num_style_feat, in_channels, activation=None)
Defensive patterns
Strategy: validation
Validate before calling
valid = {None, 'fused_lrelu'}
assert activation in valid, f'activation must be one of {valid}, got {activation!r}' Type guard
def is_equal_linear_activation(v) -> bool:
return v is None or (isinstance(v, str) and v == 'fused_lrelu') Prevention
- Treat stylegan2_arch.py and stylegan2_bilinear_arch.py as a pair: any change to accepted values must go into both.
- Diff the two vendored files before modifying either.
When it happens
Trigger: Building the bilinear StyleGAN2 face model with EqualLinear(..., activation=<anything except 'fused_lrelu' or None>), typically when copying layer code from the non-bilinear file that was modified to use another activation.
Common situations: Diverging the two stylegan2_arch / stylegan2_bilinear_arch copies and applying an activation change to only one; loading a face-model config tuned against a different implementation.
Related errors
- Wrong activation value in EqualLinear: {activation}Supported
- Wrong sample mode {self.sample_mode}, supported ones are ['u
- invalid distribution {distribution}
- Max depth of recursive function `tie_encoder_to_decoder` rea
- Wrong params!
AI-assisted analysis of lllyasviel/Fooocus@ae05379cc9 (2026-08-15).
Data as JSON: /api/errors/15f4a9eac869e461.
Report an issue: GitHub.