{"record":{"id":"78fc117310356764","repo":"huggingface/pytorch-image-models","slug":"importing-from-name-is-deprecated-please-im-78fc11","errorCode":null,"errorMessage":"Importing from {__name__} is deprecated, please import via timm.models","messagePattern":"Importing from (.+?) is deprecated, please import via timm\\.models","errorType":"console","errorClass":"FutureWarning","httpStatus":null,"severity":"warning","filePath":"timm/models/hub.py","lineNumber":4,"sourceCode":"from ._hub import *\n\nimport warnings\nwarnings.warn(f\"Importing from {__name__} is deprecated, please import via timm.models\", FutureWarning)\n","sourceCodeStart":1,"sourceCodeEnd":5,"githubUrl":"https://github.com/huggingface/pytorch-image-models/blob/9a5261e31b3b5128526eb2658333b4c0a54464ae/timm/models/hub.py#L1-L5","documentation":"Importing timm.models.hub is deprecated: the module moved to timm.models._hub and this shim re-exports it with a FutureWarning. Use timm.models (or timm.models._hub) for pretrained-config and checkpoint loading helpers.","triggerScenarios":"from timm.models.hub import load_state_dict_from_hf, load_state_dict_from_url; import timm.models.hub in weight-loading code.","commonSituations":"Scripts loading weights from HuggingFace Hub or custom URLs written against old timm; model zoos with custom loading logic.","solutions":["Import from timm.models: from timm.models import load_state_dict_from_hf, load_state_dict_from_url","Or use timm.models._hub for module-level access","Prefer higher-level APIs: timm.create_model(..., pretrained=True) handles loading for you"],"exampleFix":"# before\nfrom timm.models.hub import load_state_dict_from_url\n# after\nfrom timm.models import load_state_dict_from_url","handlingStrategy":"validation","validationCode":"from timm.models import load_state_dict_from_url, load_state_dict_from_hf  # modern path","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Let create_model(pretrained=True) handle loading instead of hub helpers","Import hub helpers from timm.models","Grep for 'timm.models.hub' in shared utils"],"tags":["timm","deprecation","import","hub"],"backgroundTag":"deprecated-module-import","analyzedSha":"9a5261e31b3b5128526eb2658333b4c0a54464ae","analyzedAt":"2026-08-27T02:34:25.417Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}