Module 'torch.utils' has no attribute 'model_zoo'

I wanted to load the caffe model for network in network from model zoo (https://www.dropbox.com/s/blrajqirr1p31v0/cifar10_nin.caffemodel?dl=1). I tried to follow the method given in pytorch docs: state_dict = torch.utils.model_zoo.load_url(‘https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth’) but im getting:
AttributeError: module ‘torch.utils’ has no attribute ‘model_zoo’

Am I doing something wrong?

you must’ve forgottten import torch.utils

No, I did import it. It still doesn’t work, do you suggest re-installing pytorch or something?

hmmm, what version of torch are you on?

print(torch.__version__)

oh i see now. you actually have to import

import torch.utils.model_zoo
4 Likes