I have downloaded the VGG-19 weights and placed it to **C:\Users\TB/.cache\torch\hub\checkpoints**. Here is the complete error:
`---------------------------------------------------------------------------
OSError Traceback (most recent call last)
~\anaconda3\envs\AN\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1353 try:
→ 1354 h.request(req.get_method(), req.selector, req.data, headers,
1355 encode_chunked=req.has_header(‘Transfer-encoding’))
~\anaconda3\envs\AN\lib\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
~\anaconda3\envs\AN\lib\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
~\anaconda3\envs\AN\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1246 raise CannotSendHeader()
→ 1247 self._send_output(message_body, encode_chunked=encode_chunked)
1248
~\anaconda3\envs\AN\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1006 del self._buffer[:]
→ 1007 self.send(msg)
1008
~\anaconda3\envs\AN\lib\http\client.py in send(self, data)
946 if self.auto_open:
→ 947 self.connect()
948 else:
~\anaconda3\envs\AN\lib\http\client.py in connect(self)
1413
→ 1414 super().connect()
1415
~\anaconda3\envs\AN\lib\http\client.py in connect(self)
922 if self._tunnel_host:
→ 923 self._tunnel()
924
~\anaconda3\envs\AN\lib\http\client.py in _tunnel(self)
900 self.close()
→ 901 raise OSError(“Tunnel connection failed: %d %s” % (code,
902 message.strip()))
OSError: Tunnel connection failed: 407 Proxy Authentication Required
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_8004/3520862733.py in
1 config,extra = get_config()
----> 2 main(config)
~\AppData\Local\Temp/ipykernel_8004/929139210.py in main(config)
12 data_loader = get_loader(config.image_size, config.scale_factor, config.batch_size, config.sample_batch_size)
13 trainer = Trainer(config, data_loader)
—> 14 trainer.train()
~\AppData\Local\Temp/ipykernel_8004/3677316706.py in train(self)
71 self.bp_criterion = nn.L1Loss(reduction=‘mean’)
72 if self.use_pcp:
—> 73 self.pcp_criterion = PerceptualLoss(layer_weights=self.VGG_LAYER_WEIGHTS,
** 74 vgg_type=config.VGG_TYPE,**
** 75 use_input_norm=config.USE_INPUT_NORM,**
~\AppData\Local\Temp/ipykernel_8004/3161286985.py in init(self, layer_weights, vgg_type, use_input_norm, use_pcp_loss, use_style_loss, norm_img, criterion)
196 self.use_style_loss = use_style_loss
197 self.layer_weights = layer_weights
→ 198 self.vgg = VGGFeatureExtractor(
199 layer_name_list=list(layer_weights.keys()),
200 vgg_type=vgg_type,
~\AppData\Local\Temp/ipykernel_8004/825357570.py in init(self, layer_name_list, vgg_type, use_input_norm, requires_grad, remove_pooling, pooling_stride)
96 max_idx = idx
97
—> 98 features = getattr(vgg, vgg_type)(pretrained=True).features[:max_idx + 1]
99
100 modified_net = OrderedDict()
~\anaconda3\envs\AN\lib\site-packages\torchvision\models\vgg.py in vgg19(pretrained, progress, **kwargs)
177 progress (bool): If True, displays a progress bar of the download to stderr
178 “”"
→ 179 **return _vgg(‘vgg19’, ‘E’, False, pretrained, progress, kwargs)
180
181
~\anaconda3\envs\AN\lib\site-packages\torchvision\models\vgg.py in _vgg(arch, cfg, batch_norm, pretrained, progress, **kwargs)
97 model = VGG(make_layers(cfgs[cfg], batch_norm=batch_norm), kwargs)
98 if pretrained:
—> 99 state_dict = load_state_dict_from_url(model_urls[arch],
** 100 progress=progress)
101 model.load_state_dict(state_dict)
~\anaconda3\envs\AN\lib\site-packages\torch\hub.py in load_state_dict_from_url(url, model_dir, map_location, progress, check_hash, file_name)
522 r = HASH_REGEX.search(filename) # r is Optional[Match[str]]
523 hash_prefix = r.group(1) if r else None
→ 524 download_url_to_file(url, cached_file, hash_prefix, progress=progress)
525
526 if _is_legacy_zip_format(cached_file):
~\anaconda3\envs\AN\lib\site-packages\torch\hub.py in download_url_to_file(url, dst, hash_prefix, progress)
392 # certificates in older Python
393 req = Request(url, headers={“User-Agent”: “torch.hub”})
→ 394 u = urlopen(req)
395 meta = u.info()
396 if hasattr(meta, ‘getheaders’):
~\anaconda3\envs\AN\lib\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):
~\anaconda3\envs\AN\lib\urllib\request.py in open(self, fullurl, data, timeout)
523
524 sys.audit(‘urllib.Request’, req.full_url, req.data, req.headers, req.get_method())
→ 525 response = self._open(req, data)
526
527 # post-process response
~\anaconda3\envs\AN\lib\urllib\request.py in _open(self, req, data)
540
541 protocol = req.type
→ 542 result = self._call_chain(self.handle_open, protocol, protocol +
543 ‘_open’, req)
544 if result:
~\anaconda3\envs\AN\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
500 for handler in handlers:
501 func = getattr(handler, meth_name)
→ 502 result = func(*args)
503 if result is not None:
504 return result
~\anaconda3\envs\AN\lib\urllib\request.py in https_open(self, req)
1395
1396 def https_open(self, req):
→ 1397 return self.do_open(http.client.HTTPSConnection, req,
1398 context=self._context, check_hostname=self._check_hostname)
1399
~\anaconda3\envs\AN\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1355 encode_chunked=req.has_header(‘Transfer-encoding’))
1356 except OSError as err: # timeout error
→ 1357 raise URLError(err)
1358 r = h.getresponse()
1359 except:
URLError: <urlopen error Tunnel connection failed: 407 Proxy Authentication Required>
`