Cannot load torchvision model in local machine

Hi, I am trying to use transfer learning, but the problem is I can’t load the model on my local machine. It takes forever to load a model.

It keeps showing Downloading: "https://download.pytorch.org/models/resnet50-0676ba61.pth" to /home/peter/.cache/torch/hub/checkpoints/resnet50-0676ba61.pth

This is my code

import torchvision 
from torchvision.models import resnet50, ResNet50_Weights

model = torchvision.models.resnet50(weights=ResNet50_Weights.IMAGENET1K_V1

However, I tried it on google Colab my code seems to work fine. I also tried several models in Torchvision, but I can’t load them. Thank you.

I can download torchvision models without a problem. The file is about 90 mb, so it should take a few minutes (worst case) with decent internet connection.
Is there any network setting that would prevent this, e.g. VPN?

Maybe, you can also run the following to see the problem is about your network setting

wget https://download.pytorch.org/models/resnet50-0676ba61.pth

This will download the model to the current working directory

1 Like