-
Notifications
You must be signed in to change notification settings - Fork 7.1k
AttributeError: module 'torchvision.models' has no attribute 'mnasnet' #5087
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
Comments
I think your pytorch and torchvision versions don't match. Also see #2912
Edit: |
You should try
|
@oke-aditya Thanks how do I uninstall the previous version that I installed? Or I don't need to do anything just run that command that you provided? |
You can either create a fresh environment using conda and install again. (easy way) Or uninstall packages using pip and conda then install |
@oke-aditya can you please send me command how do I uninstall it using pip in order to remove all files? Please send me all commands for the complete uninstallation |
I would suggest to remove all the packages.
(Press y to say yes and remove stuff) Then cleanup the conda environment. (Coz your device is CUDA 9.2 and you have CUDA 10. 2 installed so pytorch won't run) This will activate the base environment
Beware!! The below command will completely remove the environment.
Now you can create a fresh environment
And proceed with installation as mentioned on the site. Hope I helped you. :) It's bit hard to communicate installation issues :( |
@oke-aditya Thank you so much for your help. I tried installing with the command you gave me: but when I run this I get this: vi system_info.txt uname_result(system='Linux', node='gpu-2-0.saber', release='3.10.0-862.el7.x86_64', version='#1 SMP Fri Apr 20 16:44:24 UTC 2018', machine='x86_64', processor='x86_64') Number of GPUs on current device : 1 Can you please advice how to install pytorch so that the above scrip can run, this module part: For this version of pytorch installation these modules don't work: What is the version and how to install Pytorch so that it does work with my: Please advise, |
@anamariaUIC It should be one of
See this list for all available classification models. |
@pmeier @oke-aditya thank you for getting back to me. @pmeier How should I use the information from your comment to either install or run pytorch, given I want to run this script |
@anamariaUIC please follow the latest pytorch version following the official instructions https://pytorch.org/get-started/locally/ FYI this works fine (from the script you linked) with the latest version: MODEL_LIST = {
models.mnasnet: models.mnasnet.__all__[1:],
models.resnet: models.resnet.__all__[1:],
models.densenet: models.densenet.__all__[1:],
models.squeezenet: models.squeezenet.__all__[1:],
models.vgg: models.vgg.__all__[1:],
models.mobilenet: models.mobilenet.mv2_all[1:],
models.mobilenet: models.mobilenet.mv3_all[1:],
models.shufflenetv2: models.shufflenetv2.__all__[1:],
} Since this is a usage question more than a bug or an issue related to torchvision, I'll close the issue. |
That is a question you should ask the author of the script. You can import the from torchvision import models
models.mnasnet0_5(...) |
@NicolasHug does the latest version of pytorch works with CUDA 9.2? Because if it doesn't I can't use it. I am doing this on a cluster where drivers are version 396 (please see details from my previous comments) and only Cuda 9.2 can be used... |
@anamariaUIC please see https://pytorch.org/get-started/previous-versions/ for cuda / pytroch compatibility and our readme for torch / torchvision compatibility. There's a chance that not all models will be available in torchvision if you need to rely on such an old CUDA version, unfortunately |
Nope. The last release that supports CUDA 9.2 is |
ok, So I did install the latest version of pytorch that works with CUDA 9.2 via: conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=9.2 -c pytorch And for example models.mnasnet doesn't work with it as invoked in this script: Is this only the issue of invoking it instead with: or mnasnet: models doesn't work at all with pytorch==1.7.1? |
🐛 Describe the bug
I installed pytorch via:
conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=9.2 -c pytorch
associated python version is: Python 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0] :: Anaconda, Inc. on linux
I am running this script: https://github.com/ryujaehun/pytorch-gpu-benchmark/blob/main/benchmark_models.py
and I am getting this Error:
Traceback (most recent call last):
File "python_test_GPU.py", line 22, in
models.mnasnet: models.mnasnet.all[1:],
AttributeError: module 'torchvision.models' has no attribute 'mnasnet'
Versions
Collecting environment information...
PyTorch version: 1.0.1.post2
Is debug build: False
CUDA used to build PyTorch: 9.0.176
ROCM used to build PyTorch: N/A
OS: CentOS Linux 7 (Core) (x86_64)
GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
Clang version: Could not collect
CMake version: version 2.8.12.2
Libc version: glibc-2.10
Python version: 3.7.4 (default, Aug 13 2019, 20:35:49) [GCC 7.3.0] (64-bit runtime)
Python platform: Linux-3.10.0-862.el7.x86_64-x86_64-with-centos-7.5.1804-Core
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.20.2
[pip3] numpydoc==0.9.1
[pip3] torch==1.0.1.post2
[pip3] torchaudio==0.7.0a0+ac17b64
[pip3] torchvision==0.2.2.post3
[conda] blas 1.0 mkl
[conda] cudatoolkit 10.2.89 hfd86e86_1
[conda] mkl 2019.4 243
[conda] mkl-service 2.3.0 py37he904b0f_0
[conda] mkl_fft 1.0.14 py37ha843d7b_0
[conda] mkl_random 1.1.0 py37hd6b4f25_0
[conda] numpy 1.17.2 py37haad9e8e_0
[conda] numpy-base 1.17.2 py37hde5b4d6_0
[conda] numpydoc 0.9.1 py_0
[conda] pytorch 1.7.0 py3.7_cuda10.2.89_cudnn7.6.5_0 pytorch
[conda] torchaudio 0.7.0 py37 pytorch
[conda] torchvision 0.8.0 py37_cu102 pytorch
The text was updated successfully, but these errors were encountered: