lllyasviel/Fooocus · error · NotImplementedError
{model_name} is not implemented.
Error message
{model_name} is not implemented. What it means
facexlib's init_detection_model only supports two detection model names: 'retinaface_resnet50' and 'retinaface_mobile0.25'. Any other string raises NotImplementedError before any weights are loaded or downloaded.
Source
Thrown at extras/facexlib/detection/__init__.py:16
import torch
from copy import deepcopy
from extras.facexlib.utils import load_file_from_url
from .retinaface import RetinaFace
def init_detection_model(model_name, half=False, device='cuda', model_rootpath=None):
if model_name == 'retinaface_resnet50':
model = RetinaFace(network_name='resnet50', half=half, device=device)
model_url = 'https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth'
elif model_name == 'retinaface_mobile0.25':
model = RetinaFace(network_name='mobile0.25', half=half, device=device)
model_url = 'https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_mobilenet0.25_Final.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)
# TODO: clean pretrained model
load_net = torch.load(model_path, map_location=lambda storage, loc: storage, weights_only=True)
# remove unnecessary 'module.'
for k, v in deepcopy(load_net).items():
if k.startswith('module.'):
load_net[k[7:]] = v
load_net.pop(k)
model.load_state_dict(load_net, strict=True)
model.eval()
model = model.to(device)
return model
View on GitHub (pinned to ae05379cc9)
Solutions
- Use exactly 'retinaface_resnet50' or 'retinaface_mobile0.25'
- Check the literal strings in extras/facexlib/detection/__init__.py if unsure which names this vendored version supports
- Upgrade/patch facexlib locally if you genuinely need another detection backbone
Example fix
// before
init_detection_model('resnet50', half=True, device='cuda')
// after
init_detection_model('retinaface_resnet50', half=True, device='cuda') Defensive patterns
Strategy: type-guard
Validate before calling
SUPPORTED_DETECTION_MODELS = {'retinaface_resnet50', 'retinaface_mobile0.25'}
assert model_name in SUPPORTED_DETECTION_MODELS, f'use one of {SUPPORTED_DETECTION_MODELS}' Type guard
def is_supported_detection_model(name: str) -> bool:
return name in {'retinaface_resnet50', 'retinaface_mobile0.25'} Try / catch
try:
det = init_detection_model(name)
except NotImplementedError:
det = init_detection_model('retinaface_resnet50') # safe default Prevention
- Use a constant/enum for model names instead of free strings
- Pin the vendored facexlib version in docs
- Fail fast on unknown names with the supported list in the message
When it happens
Trigger: Calling init_detection_model('retinaface_mobilenet') (wrong name), 'resnet50' (missing prefix), or a new architecture name that this vendored facexlib version never implemented.
Common situations: Copy-pasting model names from other facexlib/GFPGAN versions or READMEs; name drift between upstream facexlib releases and the vendored copy in extras/; users assuming any timm backbone name works.
Related errors
- network_name={network_name}
- {model_name} is not implemented.
- No paddings to do, output_size must be None or {}
- Not (0 <= inner_padding_factor <= 1.0)
- Not (outer_padding[0] < output_size[0] and outer_padding[1]
AI-assisted analysis of lllyasviel/Fooocus@ae05379cc9 (2026-08-15).
Data as JSON: /api/errors/d7390af05c4d9060.
Report an issue: GitHub.