{"record":{"id":"e8130925bd3ae0f8","repo":"invoke-ai/InvokeAI","slug":"unknown-model-s","errorCode":null,"errorMessage":"Unknown model (%s)","messagePattern":"Unknown model \\((.+?)\\)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/model_factory.py","lineNumber":22,"sourceCode":"from .gen_efficientnet import *\nfrom .mobilenetv3 import *\n\n\ndef create_model(\n        model_name='mnasnet_100',\n        pretrained=None,\n        num_classes=1000,\n        in_chans=3,\n        checkpoint_path='',\n        **kwargs):\n\n    model_kwargs = dict(num_classes=num_classes, in_chans=in_chans, pretrained=pretrained, **kwargs)\n\n    if model_name in globals():\n        create_fn = globals()[model_name]\n        model = create_fn(**model_kwargs)\n    else:\n        raise RuntimeError('Unknown model (%s)' % model_name)\n\n    if checkpoint_path and not pretrained:\n        load_checkpoint(model, checkpoint_path)\n\n    return model\n","sourceCodeStart":4,"sourceCodeEnd":28,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/geffnet/model_factory.py#L4-L28","documentation":"geffnet's create_model dispatches by looking the model name up in the factory module's globals(): if model_name is not a registered factory function name, it raises RuntimeError('Unknown model (%s)'). The factory only knows names for which a per-model builder function (e.g. efficientnet_b0, mobilenetv3_large_100) exists in geffnet.model_factory.","triggerScenarios":"create_model(model_name='...') where model_name does not match any builder function defined in geffnet/model_factory.py — e.g. any name not in the module's globals(), including timm-style names, suffixed names, or typos.","commonSituations":"Using timm model identifiers in geffnet (different naming scheme); typos like 'efficientnet-b0' (dash) instead of 'efficientnet_b0'; asking for a model variant the installed geffnet version predates; assuming create_model resolves paths like 'geffnet/efficientnet_b0'.","solutions":["Check the exact registered names (e.g. [n for n in dir(geffnet.model_factory) if not n.startswith('_')]) and pass one verbatim, such as 'efficientnet_b0'.","Correct dashes/dots to underscores: 'efficientnet-b0' -> 'efficientnet_b0'.","If the name comes from timm or another library, use that library's create_model, or map it to the equivalent geffnet name.","If a genuinely new architecture is needed, add a builder function to geffnet.model_factory so the name exists in globals()."],"exampleFix":"// before\nmodel = geffnet.create_model('tf_efficientnet_b0')  # RuntimeError: Unknown model\n// after\nmodel = geffnet.create_model('efficientnet_b0')  # registered factory name","handlingStrategy":"validation","validationCode":"import geffnet.model_factory as mf\nvalid = {n for n in dir(mf) if callable(getattr(mf, n)) and not n.startswith('_')}\nif model_name not in valid:\n    raise ValueError(f'{model_name!r} not in geffnet factory; pick from sorted(valid)')","typeGuard":"def is_known_geffnet_model(name: str) -> bool:\n    import geffnet.model_factory as mf\n    return callable(getattr(mf, name, None))","tryCatchPattern":"try:\n    model = geffnet.create_model(model_name)\nexcept RuntimeError as e:\n    if 'Unknown model' in str(e):\n        raise ValueError(f'{model_name} is not a registered geffnet model') from e\n    raise","preventionTips":["List available names via dir(geffnet.model_factory) and keep them in a config whitelist.","Use underscore-separated names ('efficientnet_b0'), never timm-style dashes/prefixes.","Pin the geffnet version and only reference models documented for that version.","Centralize model-name strings as constants instead of ad-hoc literals."],"tags":["python","invalid-argument","model-registry","runtime-error"],"backgroundTag":"unknown-model-name","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}