{"record":{"id":"68cf0d6c092e08ea","repo":"huggingface/pytorch-image-models","slug":"model-architecture-arch-name-has-no-pretrained","errorCode":null,"errorMessage":"Model architecture ({arch_name}) has no pretrained cfg registered.","messagePattern":"Model architecture \\((.+?)\\) has no pretrained cfg registered\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"timm/models/_registry.py","lineNumber":336,"sourceCode":"    assert isinstance(module_names, (tuple, list, set))\n    return any(arch_name in _module_to_models[n] for n in module_names)\n\n\ndef is_model_pretrained(model_name: str) -> bool:\n    return model_name in _model_has_pretrained\n\n\ndef get_pretrained_cfg(model_name: str, allow_unregistered: bool = True) -> Optional[PretrainedCfg]:\n    if model_name in _model_pretrained_cfgs:\n        return deepcopy(_model_pretrained_cfgs[model_name])\n    arch_name, tag = split_model_name_tag(model_name)\n    if arch_name in _model_default_cfgs:\n        # if model arch exists, but the tag is wrong, error out\n        raise RuntimeError(f'Invalid pretrained tag ({tag}) for {arch_name}.')\n    if allow_unregistered:\n        # if model arch doesn't exist, it has no pretrained_cfg registered, allow a default to be created\n        return None\n    raise RuntimeError(f'Model architecture ({arch_name}) has no pretrained cfg registered.')\n\n\ndef get_pretrained_cfg_value(model_name: str, cfg_key: str) -> Optional[Any]:\n    \"\"\" Get a specific model default_cfg value by key. None if key doesn't exist.\n    \"\"\"\n    cfg = get_pretrained_cfg(model_name, allow_unregistered=False)\n    return getattr(cfg, cfg_key, None)\n\n\ndef get_arch_pretrained_cfgs(model_name: str) -> Dict[str, PretrainedCfg]:\n    \"\"\" Get all pretrained cfgs for a given architecture.\n    \"\"\"\n    arch_name, _ = split_model_name_tag(model_name)\n    model_names = _model_with_tags[arch_name]\n    cfgs = {m: _model_pretrained_cfgs[m] for m in model_names}\n    return cfgs\n","sourceCodeStart":318,"sourceCodeEnd":353,"githubUrl":"https://github.com/huggingface/pytorch-image-models/blob/9a5261e31b3b5128526eb2658333b4c0a54464ae/timm/models/_registry.py#L318-L353","documentation":"timm's pretrained-configuration lookup could not find any pretrained cfg registered for the given architecture name. Every model registered via register_model has a default pretrained cfg (usually tagged 'default'); if the name is not in _model_default_cfgs at all and allow_unregistered is False, this RuntimeError is raised. It typically means the model name is misspelled, the model was never registered, or timm was imported in a way that skipped model registration.","triggerScenarios":"Calling timm.create_model('nonexistent_or_typo_arch', pretrained=True), timm.resolve_pretrained_cfg('bad_name'), or timm.get_pretrained_cfg_value('bad_name', 'input_size') where the arch string does not match any registered model.","commonSituations":"Typos in model names ('resnet50' vs 'resnet_50'), referencing a model removed/renamed in a newer timm release, custom models registered with register_model but no pretrained_cfgs argument, or partial imports that bypass timm.models register decorators.","solutions":["Verify the exact name via timm.list_models() (optionally with a filter like timm.list_models('*coat*')) and correct the string","If it is a custom model, pass pretrained_cfgs (or a default cfg) when calling register_model","Pass allow_unregistered=True if you intentionally want a cfg-less model (only valid through APIs that expose the flag)","Pin/upgrade timm to a version that contains the model you expect"],"exampleFix":"# before\nmodel = timm.create_model('resnet50v', pretrained=True)\n# after\nimport timm\nprint([m for m in timm.list_models('*resnet50*')])\nmodel = timm.create_model('resnet50s', pretrained=True)","handlingStrategy":"validation","validationCode":"import timm\n\nvalid = set(timm.list_models(pretrained=True))\nif name not in valid:\n    close = timm.list_models(f'{name[:6]}*')\n    raise KeyError(f'{name} unknown; candidates: {close}')\nmodel = timm.create_model(name, pretrained=True)","typeGuard":"def is_registered_timm_model(name: str) -> bool:\n    import timm\n    return name in set(timm.list_models())","tryCatchPattern":"try:\n    cfg = timm.resolve_pretrained_cfg(name)\nexcept RuntimeError as e:\n    # fall back to offline/custom weights or corrected name\n    suggestions = timm.list_models(name[:5] + '*')\n    name = suggestions[0]\n    cfg = timm.resolve_pretrained_cfg(name)","preventionTips":["Keep an allowlist of model names generated from timm.list_models() in config validation","Pin the timm version in requirements so model-name availability is stable","Run a smoke-test at app startup that resolves pretrained cfgs for all configured models"],"tags":["timm","model-registry","pretrained","config"],"backgroundTag":"unknown-model-identifier","analyzedSha":"9a5261e31b3b5128526eb2658333b4c0a54464ae","analyzedAt":"2026-08-27T02:34:25.417Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}