lllyasviel/Fooocus · error · NotImplementedError
normalization layer [{:s}] is not found
Error message
normalization layer [{:s}] is not found What it means
block.norm() is the normalization factory: it builds BatchNorm2d for 'batch' and InstanceNorm2d for 'instance'; every other norm_type raises NotImplementedError. There is no 'none'/null option here - conv_block callers must skip normalization at a higher level rather than pass a string like 'none'.
Source
Thrown at ldm_patched/pfn/architecture/block.py:46
layer = nn.LeakyReLU(neg_slope, inplace)
elif act_type == "prelu":
layer = nn.PReLU(num_parameters=n_prelu, init=neg_slope)
else:
raise NotImplementedError(
"activation layer [{:s}] is not found".format(act_type)
)
return layer
def norm(norm_type: str, nc: int):
# helper selecting normalization layer
norm_type = norm_type.lower()
if norm_type == "batch":
layer = nn.BatchNorm2d(nc, affine=True)
elif norm_type == "instance":
layer = nn.InstanceNorm2d(nc, affine=False)
else:
raise NotImplementedError(
"normalization layer [{:s}] is not found".format(norm_type)
)
return layer
def pad(pad_type: str, padding):
# helper selecting padding layer
# if padding is 'zero', do by conv layers
pad_type = pad_type.lower()
if padding == 0:
return None
if pad_type == "reflect":
layer = nn.ReflectionPad2d(padding)
elif pad_type == "replicate":
layer = nn.ReplicationPad2d(padding)
else:
raise NotImplementedError(
"padding layer [{:s}] is not implemented".format(pad_type)View on GitHub (pinned to ae05379cc9)
Solutions
- Pass norm_type='batch' or 'instance', or None/False at the conv_block level to skip normalization entirely
- Sanitize config values: map 'none'/''/null to None before they reach norm()
Example fix
# before
layer = B.norm('none', 64) # -> NotImplementedError
# after: skip normalization at the caller level
conv = B.conv_block(64, 64, norm_type=None) # norm() never called Defensive patterns
Strategy: validation
Validate before calling
def sanitize_norm(norm_type):
if norm_type is None:
return None
n = norm_type.lower()
if n in ('', 'none', 'null', 'false'):
return None # caller must then SKIP the norm layer
assert n in ('batch', 'instance'), f'norm must be batch/instance/None, got {norm_type!r}'
return n
conv = B.conv_block(64, 64, norm_type=sanitize_norm(cfg.get('norm'))) Type guard
def is_supported_norm(norm_type) -> bool:
return norm_type is None or (isinstance(norm_type, str) and norm_type.lower() in ('batch', 'instance')) Prevention
- Use None/False to skip normalization; 'none' as a string is NOT accepted by norm()
- Normalize config values: map 'none'/''/null to None before model construction
When it happens
Trigger: Calling norm('none', nc), norm('group', nc), or norm('batch0') - i.e. any norm_type besides 'batch'/'instance'. Typically triggered by a conv_block(act, norm_type='none') call pattern copied from code that treats 'none' as a valid sentinel.
Common situations: Configs from other BasicSR forks where norm_type: null / 'none' is written out explicitly; generated model params where the norm field is defaulted to a string instead of None; typos ('Batch', 'instanceNorm').
Related errors
- activation layer [{:s}] is not found
- padding layer [{:s}] is not implemented
- scale {scale} is not supported. Supported scales: 2^n and 3.
- scale {scale} is not supported. Supported scales: 2^n and 3.
- Upsample mode [{self.upsampler}] is not found
AI-assisted analysis of lllyasviel/Fooocus@ae05379cc9 (2026-08-15).
Data as JSON: /api/errors/f9b75a116e052838.
Report an issue: GitHub.