I’m trying to load a pretrained vgg16 with: cnn = torchvision.models.vgg19(pretrained=True)
But I get the following error:
Downloading: "https://download.pytorch.org/models/vgg19-dcbb9e9d.pth" to /home/.torch/models/vgg19-dcbb9e9d.pth
Traceback (most recent call last):
File "main.py", line 19, in <module>
train.trainer(config)
File "/home/some-folder/train.py", line 18, in trainer
cnn = torchvision.models.vgg19(pretrained=True)
File "/home/pytorch/local/lib/python2.7/site-packages/torchvision/models/vgg.py", line 141, in vgg19
model.load_state_dict(model_zoo.load_url(model_urls['vgg19']))
File "/home/pytorch/local/lib/python2.7/site-packages/torch/utils/model_zoo.py", line 56, in load_url
_download_url_to_file(url, cached_file, hash_prefix)
File "/home/pytorch/local/lib/python2.7/site-packages/torch/utils/model_zoo.py", line 61, in _download_url_to_file
u = urlopen(url)
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>
I couldn’t find anything useful with googling.
Thanks in advance.
wget https://download.pytorch.org/models/vgg19-dcbb9e9d.pth
and then mv vgg19-dcbb9e9d.pth ~/.torch/models/
solved the problem.
The line cnn = torchvision.models.vgg19(pretrained=True) still did not work though, before downloading with wget.
Not sure if it’s problem of mine or not…
Its most probably network issue. I solved it by downloading the checkpoints customly and saving it in the cache directory where it searches the checkpoint before running the model.