huggingface/pytorch-image-models · warning · FutureWarning

Importing from {__name__} is deprecated, please import via t

Error message

Importing from {__name__} is deprecated, please import via timm.models

What it means

Importing timm.models.helpers is deprecated: its contents were split into timm.models._builder, _helpers, _manipulate, and _prune, and the shim re-exports all of them with a FutureWarning. Import via timm.models instead.

Source

Thrown at timm/models/helpers.py:7

from ._builder import *
from ._helpers import *
from ._manipulate import *
from ._prune import *

import warnings
warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.models", FutureWarning)

View on GitHub (pinned to 9a5261e31b)

Solutions

  1. Import from timm.models: from timm.models import build_model_with_cfg, checkpoint_seq
  2. Use the specific private modules (timm.models._builder etc.) if needed
  3. Grep and replace 'timm.models.helpers' across the project

Example fix

# before
from timm.models.helpers import build_model_with_cfg
# after
from timm.models import build_model_with_cfg
Defensive patterns

Strategy: validation

Validate before calling

from timm.models import build_model_with_cfg, checkpoint_seq, adapt_input_conv  # modern path

Prevention

When it happens

Trigger: from timm.models.helpers import build_model_with_cfg, checkpoint_seq, adapt_input_conv, resolve_pretrained_cfg; import timm.models.helpers in model-construction utilities.

Common situations: Custom models built with build_model_with_cfg; repositories vendoring timm model helpers from pre-0.9 versions.

Related errors


AI-assisted analysis of huggingface/pytorch-image-models@9a5261e31b (2026-08-27). Data as JSON: /api/errors/59d475510afb4e0b. Report an issue: GitHub.