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

  1. Use model_name='bisenet' (default, 19 classes) or model_name='parsenet'.
  2. Verify exact spelling/case; the comparison is a plain == on the string.
  3. If 'parsenet' is rejected, your facexlib checkout is outdated — update the extras/facexlib submodule/package.
  4. 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

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


AI-assisted analysis of lllyasviel/Fooocus@ae05379cc9 (2026-08-15). Data as JSON: /api/errors/3762080f90a395ee. Report an issue: GitHub.