MadryLab / robustness

A library for experimenting with, training and evaluating neural networks, with a focus on adversarial robustness.
MIT License
903 stars 181 forks source link

import of `custom_modules` breaking with newer version of python/pytorch/torchvision #114

Closed lyob closed 2 years ago

lyob commented 2 years ago

When I use a more recent version of python (3.8), pytorch (torch==1.11) and torchvision (0.12.0), I have trouble importing custom_modules. Could this be due to a naming conflict? For some reason, I have no issue importing when I use older versions of python (3.6), pytorch (1.7.1) and torchvision (0.8.2), but my code requires more recent versions of these packages.

Here's the traceback:

Traceback (most recent call last):
  File "foo.py", line 23, in <module>
    from bar import ResNet, BasicBlock
  File "bar.py", line 10, in <module>
    from robustness.imagenet_models import custom_modules
ImportError: cannot import name 'custom_modules' from 'robustness.imagenet_models' (/path/to/robustness/robustness/imagenet_models/__init__.py)

Thanks.