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

No module named 'torchvision.models.mobilenetv2' #4157

Closed
onlinehuazai opened this issue Jul 7, 2021 · 8 comments
Closed

No module named 'torchvision.models.mobilenetv2' #4157

onlinehuazai opened this issue Jul 7, 2021 · 8 comments

Comments

@onlinehuazai
Copy link

🐛 Bug

model = torch.hub.load('pytorch/vision:v0.9.0', 'resnext50_32x4d', pretrained=True)

ModuleNotFoundError: No module named 'torchvision.models.mobilenetv2'

@NicolasHug
Copy link
Member

I can't reproduce this issue because I'm hitting #4156 for now.

However this seems quite strange: torchvision.models.mobilenetv2 was created in #3177 and this was in before the 0.9.0 release, so the module should exist.

@NicolasHug
Copy link
Member

I can't reproduce this issue even without hitting #4156. @onlinehuazai could you please provide the output of

wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py

as asked in the issue template?

@lstrgar
Copy link

lstrgar commented Aug 7, 2021

I'm having the same problem!

@lstrgar
Copy link

lstrgar commented Aug 7, 2021

fixed if I pull from v0.8.0

@fmassa
Copy link
Member

fmassa commented Aug 9, 2021

@lstrgar can you paste in a comment the output of

wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py

?

@fmassa
Copy link
Member

fmassa commented Sep 8, 2021

Closing due to inactivity

@fmassa fmassa closed this as completed Sep 8, 2021
@flyforwardFast
Copy link

flyforwardFast commented Dec 21, 2021

I have the same issue with torch 1.7.1+cpu on win10. do we have a fix here? or we should rely purely on the torchvision.models?

I am providing my env using the "collect_env.py" you provided

Thanks.

Python version: 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19041-SP0
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.19.5
[pip3] numpydoc==0.7.0
[pip3] torch==1.7.1
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.4.1
[conda] blas                      1.0                         mkl
[conda] mkl                       2020.0                      166
[conda] mkl-service               2.3.0            py36hb782905_0
[conda] mkl_fft                   1.0.15           py36h14836fe_0
[conda] mkl_random                1.1.0            py36h675688f_0
[conda] numpy                     1.19.5                   pypi_0    pypi
[conda] numpydoc                  0.7.0            py36ha25429e_0
[conda] torch                     1.7.1                    pypi_0    pypi
[conda] torchsummary              1.5.1                    pypi_0    pypi
[conda] torchvision               0.4.1                    pypi_0    pypi

@thakral-kartik
Copy link

🐛 Bug

model = torch.hub.load('pytorch/vision:v0.9.0', 'resnext50_32x4d', pretrained=True)

ModuleNotFoundError: No module named 'torchvision.models.mobilenetv2'

This is probably because the version of torchvision installed is older as compared to the version of vision you are passing in torch.hub(). Match them by passing the same version in torch.hub() and it should work like a charm.

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

No branches or pull requests

7 participants