question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
EdHerediacommented, May 31, 2021

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.

1reaction
oke-adityacommented, May 31, 2021

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

/home/usename/.cache/torch/hub/checkpoints/

E.g. in my case assume my username is abc and I download resnet50 weights.

/home/abc/.cache/torch/hub/checkpoints/resnet50-0676ba61.pth

This would allow you to load pretrained weights using models.resnet50(pretrained=True).

Feel free to re-open!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't download the pre trained models · Issue #272 - GitHub
go to input>superpoint pytorch>superpoint pytorch>models. All the weights are saved there. I took the resnet50 decoder and encoder; tried it in ...
Read more >
tensorflow - Unable to download pre-trained model from zoo
Try to open a new tab and paste a link to the model there. When I simply tried clicking on the github page...
Read more >
A problem about downloading pretrained models - Kaggle
New to kaggle kernel, and i am going to use kernel to train a image classification model using transfer-learning. But when i tried...
Read more >
Cellpose 2.1.1 cannot download size model in jupyter-lab
This works for the Cellpose 1 models, but not for the pre-trained Cellpose 2 models, like LC1 (see below, last 2 line).
Read more >
Not able to download pretrained models - Clara Train SDK
Hello,. I have been using clara_pt_prostate_mri_segmentation_1 pretrained model for a few month without any issues. Since today, I cannot ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found