{"record":{"id":"3762080f90a395ee","repo":"lllyasviel/Fooocus","slug":"model-name-is-not-implemented-376208","errorCode":null,"errorMessage":"{model_name} is not implemented.","messagePattern":"(.+?) is not implemented\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"extras/facexlib/parsing/__init__.py","lineNumber":16,"sourceCode":"import torch\n\nfrom extras.facexlib.utils import load_file_from_url\nfrom .bisenet import BiSeNet\nfrom .parsenet import ParseNet\n\n\ndef init_parsing_model(model_name='bisenet', half=False, device='cuda', model_rootpath=None):\n    if model_name == 'bisenet':\n        model = BiSeNet(num_class=19)\n        model_url = 'https://github.com/xinntao/facexlib/releases/download/v0.2.0/parsing_bisenet.pth'\n    elif model_name == 'parsenet':\n        model = ParseNet(in_size=512, out_size=512, parsing_ch=19)\n        model_url = 'https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth'\n    else:\n        raise NotImplementedError(f'{model_name} is not implemented.')\n\n    model_path = load_file_from_url(\n        url=model_url, model_dir='facexlib/weights', progress=True, file_name=None, save_dir=model_rootpath)\n    load_net = torch.load(model_path, map_location=lambda storage, loc: storage, weights_only=True)\n    model.load_state_dict(load_net, strict=True)\n    model.eval()\n    model = model.to(device)\n    return model\n","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/lllyasviel/Fooocus/blob/ae05379cc97bc4361ec8b4ec90193dab21be763f/extras/facexlib/parsing/__init__.py#L1-L25","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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).","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."],"exampleFix":"# before\nmodel = init_parsing_model(model_name='bisenet-v2')\n\n# after\nmodel = init_parsing_model(model_name='bisenet')","handlingStrategy":"validation","validationCode":"VALID_PARSERS = {'bisenet', 'parsenet'}\nif model_name not in VALID_PARSERS:\n    raise ValueError(f'model_name must be one of {sorted(VALID_PARSERS)}, got {model_name!r}')","typeGuard":"def is_valid_parsing_model(name: str) -> bool:\n    return name in {'bisenet', 'parsenet'}","tryCatchPattern":"try:\n    model = init_parsing_model(model_name)\nexcept NotImplementedError:\n    model = init_parsing_model('bisenet')  # explicit, logged fallback if acceptable\n    logger.warning('Unknown parser %s; fell back to bisenet', model_name)","preventionTips":["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."],"tags":["facexlib","face-parsing","model-config","not-implemented"],"backgroundTag":null,"analyzedSha":"ae05379cc97bc4361ec8b4ec90193dab21be763f","analyzedAt":"2026-08-15T04:23:59.533Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}