Downloading: “https://download.pytorch.org/models/resnet18-5c106cde.pth” to /root/.cache/torch/checkpoints/resnet18-5c106cde.pth
gaierror Traceback (most recent call last)
/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1318 h.request(req.get_method(), req.selector, req.data, headers,
-> 1319 encode_chunked=req.has_header(‘Transfer-encoding’))
1320 except OSError as err: # timeout error
/opt/conda/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)
1251 “”“Send a complete request to the server.”""
-> 1252 self._send_request(method, url, body, headers, encode_chunked)
1253
/opt/conda/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
1297 body = _encode(body, ‘body’)
-> 1298 self.endheaders(body, encode_chunked=encode_chunked)
1299
/opt/conda/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)
1246 raise CannotSendHeader()
-> 1247 self._send_output(message_body, encode_chunked=encode_chunked)
1248
/opt/conda/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)
1025 del self._buffer[:]
-> 1026 self.send(msg)
1027
/opt/conda/lib/python3.7/http/client.py in send(self, data)
965 if self.auto_open:
–> 966 self.connect()
967 else:
/opt/conda/lib/python3.7/http/client.py in connect(self)
1413
-> 1414 super().connect()
1415
/opt/conda/lib/python3.7/http/client.py in connect(self)
937 self.sock = self._create_connection(
–> 938 (self.host,self.port), self.timeout, self.source_address)
939 self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
/opt/conda/lib/python3.7/socket.py in create_connection(address, timeout, source_address)
706 err = None
–> 707 for res in getaddrinfo(host, port, 0, SOCK_STREAM):
708 af, socktype, proto, canonname, sa = res
/opt/conda/lib/python3.7/socket.py in getaddrinfo(host, port, family, type, proto, flags)
751 addrlist = []
–> 752 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
753 af, socktype, proto, canonname, sa = res
gaierror: [Errno -3] Temporary failure in name resolution
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
in
----> 1 model = SVHN_Model1()
2 criterion = nn.CrossEntropyLoss()
3 optimizer = torch.optim.Adam(model.parameters(), 0.001)
4 best_loss = 1000.0
5
in init(self)
6 super(SVHN_Model1, self).init()
7
----> 8 model_conv = models.resnet18(pretrained=True)
9 model_conv.avgpool = nn.AdaptiveAvgPool2d(1)
10 model_conv = nn.Sequential(*list(model_conv.children())[:-1])
/opt/conda/lib/python3.7/site-packages/torchvision/models/resnet.py in resnet18(pretrained, progress, **kwargs)
239 “”"
240 return _resnet(‘resnet18’, BasicBlock, [2, 2, 2, 2], pretrained, progress,
–> 241 **kwargs)
242
243
/opt/conda/lib/python3.7/site-packages/torchvision/models/resnet.py in _resnet(arch, block, layers, pretrained, progress, **kwargs)
225 if pretrained:
226 state_dict = load_state_dict_from_url(model_urls[arch],
–> 227 progress=progress)
228 model.load_state_dict(state_dict)
229 return model
/opt/conda/lib/python3.7/site-packages/torch/hub.py in load_state_dict_from_url(url, model_dir, map_location, progress, check_hash)
493 sys.stderr.write(‘Downloading: “{}” to {}\n’.format(url, cached_file))
494 hash_prefix = HASH_REGEX.search(filename).group(1) if check_hash else None
–> 495 download_url_to_file(url, cached_file, hash_prefix, progress=progress)
496
497 # Note: extractall() defaults to overwrite file if exists. No need to clean up beforehand.
/opt/conda/lib/python3.7/site-packages/torch/hub.py in download_url_to_file(url, dst, hash_prefix, progress)
392 # We use a different API for python2 since urllib(2) doesn’t recognize the CA
393 # certificates in older Python
–> 394 u = urlopen(url)
395 meta = u.info()
396 if hasattr(meta, ‘getheaders’):
/opt/conda/lib/python3.7/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
220 else:
221 opener = _opener
–> 222 return opener.open(url, data, timeout)
223
224 def install_opener(opener):
/opt/conda/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)
523 req = meth(req)
524
–> 525 response = self._open(req, data)
526
527 # post-process response
/opt/conda/lib/python3.7/urllib/request.py in _open(self, req, data)
541 protocol = req.type
542 result = self._call_chain(self.handle_open, protocol, protocol +
–> 543 ‘_open’, req)
544 if result:
545 return result
/opt/conda/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
501 for handler in handlers:
502 func = getattr(handler, meth_name)
–> 503 result = func(*args)
504 if result is not None:
505 return result
/opt/conda/lib/python3.7/urllib/request.py in https_open(self, req)
1360 def https_open(self, req):
1361 return self.do_open(http.client.HTTPSConnection, req,
-> 1362 context=self._context, check_hostname=self.check_hostname)
1363
1364 https_request = AbstractHTTPHandler.do_request
/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1319 encode_chunked=req.has_header(‘Transfer-encoding’))
1320 except OSError as err: # timeout error
-> 1321 raise URLError(err)
1322 r = h.getresponse()
1323 except:
URLError: <urlopen error [Errno -3] Temporary failure in name resolution>