Workaround for HTTP Error 403: Forbidden for MNIST dataset (#6885)

This commit is contained in:
baijumeswani 2021-03-03 18:59:48 -08:00 committed by GitHub
parent fedb68429c
commit ed1883a97c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -249,6 +249,14 @@ class MNISTWrapper():
return ModelDescription([input_desc, label_desc], [loss_desc, probability_desc])
def get_loaders(self):
# TODO: Remove this temporary fix for urllib.error.HTTPError: HTTP Error 403: Forbidden
# once a more permanent solution can be found.
# Fix as per https://github.com/pytorch/vision/issues/1938#issuecomment-789986996
from six.moves import urllib
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.install_opener(opener)
args_batch_size = 64
args_test_batch_size = 1000