{"record":{"id":"a7f28f43cdfd8e15","repo":"huggingface/pytorch-image-models","slug":"mapping-deprecated-model-name-deprecated-name-to","errorCode":null,"errorMessage":"Mapping deprecated model name {deprecated_name} to current {current_name}.","messagePattern":"Mapping deprecated model name (.+?) to current (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"timm/models/_registry.py","lineNumber":143,"sourceCode":"            if tag:\n                _model_pretrained_cfgs[model_name_tag] = pretrained_cfg\n                if pretrained_cfg.has_weights:\n                    # add model w/ tag if tag is valid\n                    _model_has_pretrained.add(model_name_tag)\n                _model_with_tags[model_name].append(model_name_tag)\n            else:\n                _model_with_tags[model_name].append(model_name)  # has empty tag (to slowly remove these instances)\n\n        _model_default_cfgs[model_name] = default_cfg\n\n    return fn\n\n\ndef _deprecated_model_shim(deprecated_name: str, current_fn: Callable = None, current_tag: str = ''):\n    def _fn(pretrained=False, **kwargs):\n        assert current_fn is not None,  f'Model {deprecated_name} has been removed with no replacement.'\n        current_name = '.'.join([current_fn.__name__, current_tag]) if current_tag else current_fn.__name__\n        warnings.warn(f'Mapping deprecated model name {deprecated_name} to current {current_name}.', stacklevel=2)\n        pretrained_cfg = kwargs.pop('pretrained_cfg', None)\n        return current_fn(pretrained=pretrained, pretrained_cfg=pretrained_cfg or current_tag, **kwargs)\n    return _fn\n\n\ndef register_model_deprecations(module_name: str, deprecation_map: Dict[str, Optional[str]]):\n    mod = sys.modules[module_name]\n    module_name_split = module_name.split('.')\n    module_name = module_name_split[-1] if len(module_name_split) else ''\n\n    for deprecated, current in deprecation_map.items():\n        if hasattr(mod, '__all__'):\n            mod.__all__.append(deprecated)\n        current_fn = None\n        current_tag = ''\n        if current:\n            current_name, current_tag = split_model_name_tag(current)\n            current_fn = getattr(mod, current_name)","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/huggingface/pytorch-image-models/blob/9a5261e31b3b5128526eb2658333b4c0a54464ae/timm/models/_registry.py#L125-L161","documentation":"This warning is emitted when you instantiate a model whose name has been deprecated and mapped to its replacement. The shim warns you that the old name now builds the current model, then forwards pretrained/kwargs to the replacement function.","triggerScenarios":"Calling timm.create_model('inception_v3_old') or another name present in a module's deprecation map; passing a deprecated name that maps to a tagged variant (e.g. a .in1k tag) via _deprecated_model_shim.","commonSituations":"Old training/inference scripts pinning legacy model names; tutorials referencing renamed weights; upgrading timm where models were consolidated.","solutions":["Update the model name string to the current name shown in the warning","List available names with timm.list_models() to find the replacement","Suppress the FutureWarning if the mapping is acceptable and you cannot change the name yet"],"exampleFix":"# before\nmodel = timm.create_model('xception', pretrained=True)\n# after\nmodel = timm.create_model('xception.tf_in1k' if 'xception.tf_in1k' in timm.list_models() else 'xception', pretrained=True)","handlingStrategy":"validation","validationCode":"import warnings, timm\nname = 'inception_v3_old'\nvalid = timm.list_models()\nif name not in valid:\n    # will fall back to deprecated shim if mapped, warn, or fail\n    raise ValueError(f'{name} not in timm model list')","typeGuard":null,"tryCatchPattern":"with warnings.catch_warnings():\n    warnings.filterwarnings('ignore', message='Mapping deprecated model name')\n    model = timm.create_model('old_name', pretrained=True)","preventionTips":["Pin model names from timm.list_models() in configs","Prefer pretrained-tag names (e.g. 'vit_small_patch16_224.augreg_in1k')","Run a periodic deprecation-name audit when upgrading timm"],"tags":["timm","deprecation","model-name","migration"],"backgroundTag":"deprecated-name-mapped","analyzedSha":"9a5261e31b3b5128526eb2658333b4c0a54464ae","analyzedAt":"2026-08-27T02:34:25.417Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}