lllyasviel/Fooocus · error · NotImplementedError
{model_name} is not implemented.
Error message
{model_name} is not implemented. What it means
init_parsing_model() in facexlib only supports two face-parsing architectures: 'bisenet' (19-class BiSeNet) and 'parsenet' (ParseNet 512x512). Any other model_name raises NotImplementedError before weights are downloaded. The choice also determines which pretrained .pth is fetched from the facexlib GitHub releases.
Source
Thrown at extras/facexlib/parsing/__init__.py:16
import torch
from extras.facexlib.utils import load_file_from_url
from .bisenet import BiSeNet
from .parsenet import ParseNet
def init_parsing_model(model_name='bisenet', half=False, device='cuda', model_rootpath=None):
if model_name == 'bisenet':
model = BiSeNet(num_class=19)
model_url = 'https://github.com/xinntao/facexlib/releases/download/v0.2.0/parsing_bisenet.pth'
elif model_name == 'parsenet':
model = ParseNet(in_size=512, out_size=512, parsing_ch=19)
model_url = 'https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth'
else:
raise NotImplementedError(f'{model_name} is not implemented.')
model_path = load_file_from_url(
url=model_url, model_dir='facexlib/weights', progress=True, file_name=None, save_dir=model_rootpath)
load_net = torch.load(model_path, map_location=lambda storage, loc: storage, weights_only=True)
model.load_state_dict(load_net, strict=True)
model.eval()
model = model.to(device)
return model
View on GitHub (pinned to ae05379cc9)
Solutions
- Use model_name='bisenet' (default, 19 classes) or model_name='parsenet'.
- Verify exact spelling/case; the comparison is a plain == on the string.
- If 'parsenet' is rejected, your facexlib checkout is outdated — update the extras/facexlib submodule/package.
- To add a new architecture, extend the if/elif chain in extras/facexlib/parsing/__init__.py with the model class and its weights URL.
Example fix
# before model = init_parsing_model(model_name='bisenet-v2') # after model = init_parsing_model(model_name='bisenet')
Defensive patterns
Strategy: validation
Validate before calling
VALID_PARSERS = {'bisenet', 'parsenet'}
if model_name not in VALID_PARSERS:
raise ValueError(f'model_name must be one of {sorted(VALID_PARSERS)}, got {model_name!r}') Type guard
def is_valid_parsing_model(name: str) -> bool:
return name in {'bisenet', 'parsenet'} Try / catch
try:
model = init_parsing_model(model_name)
except NotImplementedError:
model = init_parsing_model('bisenet') # explicit, logged fallback if acceptable
logger.warning('Unknown parser %s; fell back to bisenet', model_name) Prevention
- Validate model_name against {'bisenet','parsenet'} before calling init_parsing_model.
- Keep facexlib version in sync with the code that names parsers (parsenet needs a recent copy).
- Centralize face-restore helper construction so names come from one tested constant.
When it happens
Trigger: Calling init_parsing_model(model_name='resnet') or a face-restore helper (e.g. GFPGAN/CodeFormer FaceRestoreHelper with parsenet disabled/misnamed) with anything except 'bisenet' or 'parsenet'.
Common situations: Passing a backbone name instead of an architecture name, typo like 'bisenetv2' or 'ParseNet' (case-sensitive), or a version mismatch where an old facexlib copy lacks 'parsenet' (added with the v0.2.2 weights URL).
Related errors
- network_name={network_name}
- {model_name} is not implemented.
- Max depth of recursive function `tie_encoder_to_decoder` rea
- No paddings to do, output_size must be None or {}
- Not (0 <= inner_padding_factor <= 1.0)
AI-assisted analysis of lllyasviel/Fooocus@ae05379cc9 (2026-08-15).
Data as JSON: /api/errors/3762080f90a395ee.
Report an issue: GitHub.