Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError causes by load_state_dict_from_url #86

Closed
Embeddave opened this issue Nov 27, 2020 · 1 comment
Closed

ImportError causes by load_state_dict_from_url #86

Embeddave opened this issue Nov 27, 2020 · 1 comment

Comments

@Embeddave
Copy link

Hi robustness devs,

I'm getting the following error:

Traceback (most recent call last):
  File "resnet50_cifar10.py", line 9, in <module>
    from robustness.datasets import DATASETS
  File "/home/ubuntu/anaconda3/envs/gard-core/lib/python3.7/site-packages/robustness/datasets.py", line 22, in <module>
    from . import imagenet_models, cifar_models
  File "/home/ubuntu/anaconda3/envs/gard-core/lib/python3.7/site-packages/robustness/imagenet_models/__init__.py", line 1, in <module>
    from .resnet import *
  File "/home/ubuntu/anaconda3/envs/gard-core/lib/python3.7/site-packages/robustness/imagenet_models/resnet.py", line 3, in <module>
    from torch.hub import load_state_dict_from_url
ImportError: cannot import name 'load_state_dict_from_url' from 'torch.hub' (/home/ubuntu/anaconda3/envs/gard-core/lib/python3.7/site-packages/torch/hub.py)

I have the latest version of robustness (1.2.1post1), pytorch 1.0.0, and torchvision 0.2.2

looks like one fix is a try-except clause?
zhoudaxia233/EfficientUnet-PyTorch#5

try:
    from torch.hub import load_state_dict_from_url
except ImportError:
    from torch.utils.model_zoo import load_url as load_state_dict_from_url
@Embeddave
Copy link
Author

bug went away after upgrading pytorch to 1.6 and torchvision to 0.7

sorry, I think I might have been the victim of some weird interaction b/t conda, poetry, and pip.
had to deactivate / reactivate to deal with other weird dependency issues but after doing so everything's functioning

will go ahead and close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant