{"record":{"id":"e8f1611c6bdcf7e8","repo":"huggingface/pytorch-image-models","slug":"importing-from-name-is-deprecated-please-im","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/factory.py","lineNumber":4,"sourceCode":"from ._factory 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/factory.py#L1-L5","documentation":"Importing timm.models.factory is deprecated: the module was renamed to timm.models._factory and only exists as a compatibility shim that re-exports its contents and emits this FutureWarning. New code should import from timm.models (or timm.models._factory).","triggerScenarios":"import timm.models.factory; from timm.models.factory import create_model; older scripts importing module paths from timm <0.9.","commonSituations":"Legacy training scripts, copied tutorials, third-party repos targeting old timm versions after a timm upgrade.","solutions":["Change to from timm.models import create_model (preferred public API)","Or import the private module timm.models._factory directly if you need module-style access","Upgrade third-party code that references the old path"],"exampleFix":"# before\nfrom timm.models.factory import create_model\n# after\nfrom timm import create_model","handlingStrategy":"validation","validationCode":"import warnings\nwith warnings.catch_warnings():\n    warnings.filterwarnings('ignore', message='Importing from timm.models.factory')\n    import timm.models.factory  # transitional","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Import from the timm top-level (from timm import create_model)","Add a lint rule/grep check for 'timm.models.factory'","Test imports after timm upgrades"],"tags":["timm","deprecation","import","futurewarning"],"backgroundTag":"deprecated-module-import","analyzedSha":"9a5261e31b3b5128526eb2658333b4c0a54464ae","analyzedAt":"2026-08-27T02:34:25.417Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}