Skip to content

ModuleNotFoundError of timm.models.layers.helpers with timm 0.9.2 #58

@mcollinswisc

Description

@mcollinswisc

With timm 0.9.2 installed, running the example toolbox.py command, I see an error:

Traceback (most recent call last):
  File "/home/mcollins/repo/external/EfficientFormer/toolbox.py", line 6, in <module>
    from models import *
  File "/home/mcollins/repo/external/EfficientFormer/models/__init__.py", line 1, in <module>
    from .efficientformer import efficientformer_l1, efficientformer_l3, efficientformer_l7
  File "/home/mcollins/repo/external/EfficientFormer/models/efficientformer.py", line 15, in <module>
    from timm.models.layers.helpers import to_2tuple
ModuleNotFoundError: No module named 'timm.models.layers.helpers'

I believe this is due to the changes described at:
https://github.com/huggingface/pytorch-image-models/tree/cd950e6583bd4c5961d88059ff669149d100a1d1#whats-new

timm.models.layers moved to timm.layers

Though I am not sure why the described deprecation mapping doesn't still work for the helpers module.

I see two possible changes that would address this:

  1. Update imports of timm.models.layers.helpers to the new location at timm.layers.helpers (and other imports from timm.layers)
  2. Specify the version of timm to be < 0.9 in requirements.txt

I could send a PR for either change if desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions