_model_URL import error

ImportError: cannot import name '_MODEL_URLS' from 'torchvision.models.mnasnet'

I am getting import error while import this:

from torchvision.models.mnasnet import _MODEL_URLS as URLs 

Any help would be highly appreciated.

The _MODEL_URLS dict was removed in this PR. I don’t know what exactly you want to do with these URLs, but look at the PR to see how to use the introduced weights object to load the state_dicts.

Hi @ptrblck, I updated the torch version, and this issue is resolved. However, I am getting an unusual error while downloading datasets on pycharm IDE.

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)>

my torch version is:

torch.__version__
'1.12.1'

This issue is also fixed by importing these commands on download file:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context