HTTPError: HTTP Error 403: Forbidden
See original GitHub issueHello
I tried converting couple of images in January and it worked perfectly fine but now it leads to following error. I uploaded images to Imgur as suggested but this time it leads to error.
Please assist Thank You
/usr/local/lib/python3.6/dist-packages/fastai/data_block.py:442: UserWarning: Your training set is empty. If this is by design, pass
ignore_empty=Trueto remove this warning. warn(“Your training set is empty. If this is by design, passignore_empty=Trueto remove this warning.”) /usr/local/lib/python3.6/dist-packages/fastai/data_block.py:445: UserWarning: Your validation set is empty. If this is by design, usesplit_none()or passignore_empty=Truewhen labelling to remove this warning. or passignore_empty=Truewhen labelling to remove this warning.“”") Downloading: “https://download.pytorch.org/models/resnet34-333f7ec4.pth” to /root/.cache/torch/checkpoints/resnet34-333f7ec4.pth
HTTPError Traceback (most recent call last) <ipython-input-47-d41e8163fe4e> in <module>() ----> 1 colorizer = get_image_colorizer(artistic=True)
15 frames /content/DeOldify/deoldify/visualize.py in get_image_colorizer(render_factor, artistic) 309 ) -> ModelImageVisualizer: 310 if artistic: –> 311 return get_artistic_image_colorizer(render_factor=render_factor) 312 else: 313 return get_stable_image_colorizer(render_factor=render_factor)
/content/DeOldify/deoldify/visualize.py in get_artistic_image_colorizer(root_folder, weights_name, results_dir, render_factor) 332 render_factor: int = 35, 333 ) -> ModelImageVisualizer: –> 334 learn = gen_inference_deep(root_folder=root_folder, weights_name=weights_name) 335 filtr = MasterFilter([ColorizerFilter(learn=learn)], render_factor=render_factor) 336 vis = ModelImageVisualizer(filtr, results_dir=results_dir)
/content/DeOldify/deoldify/generators.py in gen_inference_deep(root_folder, weights_name, arch, nf_factor) 85 data = get_dummy_databunch() 86 learn = gen_learner_deep( —> 87 data=data, gen_loss=F.l1_loss, arch=arch, nf_factor=nf_factor 88 ) 89 learn.path = root_folder
/content/DeOldify/deoldify/generators.py in gen_learner_deep(data, gen_loss, arch, nf_factor) 105 y_range=(-3.0, 3.0), 106 loss_func=gen_loss, –> 107 nf_factor=nf_factor, 108 ) 109
/content/DeOldify/deoldify/generators.py in unet_learner_deep(data, arch, pretrained, blur_final, norm_type, split_on, blur, self_attention, y_range, last_cross, bottle, nf_factor, **kwargs)
127 “Build Unet learner from data and arch.”
128 meta = cnn_config(arch)
–> 129 body = create_body(arch, pretrained)
130 model = to_device(
131 DynamicUnetDeep(
/usr/local/lib/python3.6/dist-packages/fastai/vision/learner.py in create_body(arch, pretrained, cut)
53 def create_body(arch:Callable, pretrained:bool=True, cut:Optional[Union[int, Callable]]=None):
54 “Cut off the body of a typically pretrained model at cut (int) or cut the model as specified by cut(model) (function).”
—> 55 model = arch(pretrained)
56 cut = ifnone(cut, cnn_config(arch)[‘cut’])
57 if cut is None:
/usr/local/lib/python3.6/dist-packages/torchvision/models/resnet.py in resnet34(pretrained, progress, **kwargs) 247 “”" 248 return _resnet(‘resnet34’, BasicBlock, [3, 4, 6, 3], pretrained, progress, –> 249 **kwargs) 250 251
/usr/local/lib/python3.6/dist-packages/torchvision/models/resnet.py in _resnet(arch, block, layers, pretrained, progress, **kwargs) 221 if pretrained: 222 state_dict = load_state_dict_from_url(model_urls[arch], –> 223 progress=progress) 224 model.load_state_dict(state_dict) 225 return model
/usr/local/lib/python3.6/dist-packages/torch/hub.py in load_state_dict_from_url(url, model_dir, map_location, progress, check_hash) 490 cached_file = os.path.join(model_dir, filename) 491 if not os.path.exists(cached_file): –> 492 sys.stderr.write(‘Downloading: “{}” to {}\n’.format(url, cached_file)) 493 hash_prefix = HASH_REGEX.search(filename).group(1) if check_hash else None 494 download_url_to_file(url, cached_file, hash_prefix, progress=progress)
/usr/local/lib/python3.6/dist-packages/torch/hub.py in download_url_to_file(url, dst, hash_prefix, progress) 389 # We use a different API for python2 since urllib(2) doesn’t recognize the CA 390 # certificates in older Python –> 391 392 u = urlopen(url) 393
/usr/lib/python3.6/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context) 221 else: 222 opener = _opener –> 223 return opener.open(url, data, timeout) 224 225 def install_opener(opener):
/usr/lib/python3.6/urllib/request.py in open(self, fullurl, data, timeout) 530 for processor in self.process_response.get(protocol, []): 531 meth = getattr(processor, meth_name) –> 532 response = meth(req, response) 533 534 return response
/usr/lib/python3.6/urllib/request.py in http_response(self, request, response) 640 if not (200 <= code < 300): 641 response = self.parent.error( –> 642 ‘http’, request, response, code, msg, hdrs) 643 644 return response
/usr/lib/python3.6/urllib/request.py in error(self, proto, *args) 568 if http_err: 569 args = (dict, ‘default’, ‘http_error_default’) + orig_args –> 570 return self._call_chain(*args) 571 572 # XXX probably also want an abstract factory that knows when it makes
/usr/lib/python3.6/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args) 502 for handler in handlers: 503 func = getattr(handler, meth_name) –> 504 result = func(*args) 505 if result is not None: 506 return result
/usr/lib/python3.6/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs) 648 class HTTPDefaultErrorHandler(BaseHandler): 649 def http_error_default(self, req, fp, code, msg, hdrs): –> 650 raise HTTPError(req.full_url, code, msg, hdrs, fp) 651 652 class HTTPRedirectHandler(BaseHandler):
HTTPError: HTTP Error 403: Forbidden
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)

Top Related StackOverflow Question
Seems like it was a transitory Pytorch or Colab issue.
I was getting this yesterday evening in VideoColorizerColab notebook. I couldn’t find where it implicitly downloads the cached Pytorch files, and even the versions I had locally weren’t picked up.
Yup https://github.com/pytorch/pytorch/issues/33234
It works perfectly fine now, as @asears mentioned it seems to be pytorch-colab issue. Thank you @jantic for creating DeOldify and responding to issue quickly 😃