Cannot download pretrained models
See original GitHub issue🐛 Bug
I am trying to download pre-trained models from torchvision using both conventional PyTorch code and also manually using wget. In both cases the download procedure stalls and fails to finish.
To Reproduce
Using conventional code: from torchvision import models model = models.resnet50(pretrained=True)
Using wget: wget -c https://download.pytorch.org/models/resnet50-0676ba61.pth Also tried using http instead of https
Using conventional code the process stalls and never finishes. Using wget (http or https) I can see that the error message is ‘failed: connection timed out’. Using wget I can see that my machine keeps trying to connect but it gets the same error message. The servers are probably down or unreachable.
Also, my internet connection shows good speed and no problems. For example, I had no problem downloading the collect_env.py script recommended below.
Environment
Please copy and paste the output from our environment collection script (or fill out the checklist below manually).
You can get the script and run it with:
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
PyTorch version: 1.7.1 Is debug build: False CUDA used to build PyTorch: 10.2 ROCM used to build PyTorch: N/A
OS: Ubuntu 18.04.5 LTS (x86_64) GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 Clang version: Could not collect CMake version: version 3.10.2 Libc version: glibc-2.10
Python version: 3.7 (64-bit runtime) Python platform: Linux-5.4.0-73-generic-x86_64-with-debian-buster-sid Is CUDA available: True CUDA runtime version: 10.0.130 GPU models and configuration: GPU 0: GeForce RTX 2070 with Max-Q Design Nvidia driver version: 460.73.01 cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.5 HIP runtime version: N/A MIOpen runtime version: N/A
Versions of relevant libraries:
[pip3] numpy==1.19.2
[pip3] torch==1.7.1
[pip3] torchaudio==0.7.0a0+a853dff
[pip3] torchfile==0.1.0
[pip3] torchnet==0.0.4
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.8.2
[conda] blas 1.0 mkl
[conda] cudatoolkit 10.2.89 h8f6ccaa_8 conda-forge
[conda] mkl 2020.2 256
[conda] mkl-service 2.3.0 py37h8f50634_2 conda-forge
[conda] mkl_fft 1.2.1 py37h54f3939_0
[conda] mkl_random 1.2.0 py37h9fdb41a_1 conda-forge
[conda] numpy 1.19.2 py37h54aff64_0
[conda] numpy-base 1.19.2 py37hfa32c7d_0
[conda] pytorch 1.7.1 py3.7_cuda10.2.89_cudnn7.6.5_0 pytorch
[conda] torchaudio 0.7.2 py37 pytorch
[conda] torchfile 0.1.0 pypi_0 pypi
[conda] torchnet 0.0.4 pypi_0 pypi
[conda] torchsummary 1.5.1 pypi_0 pypi
[conda] torchvision 0.8.2 py37_cu102 pytorch
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Thanks @oke-aditya. Yes, I agree it doesn’t seem to be a torchvision problem. For now I can manually download the pretrained models and move them to the cache.
I will continue investigating and reopen if appropriate.
As such I cannot confirm any OS related issues 😅 If possible you can try switching network for ubuntu machine and try again. Perhaps that might work.
But overall I don’t see this to be really an issue pertaining to torchvision. I can suggest an alternative if you really don’t have network.
On Ubuntu
You can also manually download the weights and place in
E.g. in my case assume my username is
abc
and I download resnet50 weights.This would allow you to load pretrained weights using
models.resnet50(pretrained=True)
.Feel free to re-open!