google / caliban

Research workflows made easy, locally and in the Cloud.
https://caliban.readthedocs.io
Apache License 2.0
494 stars 67 forks source link

HTTP Error 403: Forbidden #100

Closed rahimentezari closed 3 years ago

rahimentezari commented 3 years ago

Hi I was working with caliban for a while but just now when running exactly the same code I am getting 403 error for downloading MNIST dataset:

Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz to datasets/MNIST/raw/train-images-idx3-ubyte.gz 0it [00:00, ?it/s]Traceback (most recent call last): File "mlp.py", line 257, in <module> main() File "mlp.py", line 187, in main train_dataset = load_data('train', args.dataset, args.datadir, nchannels) File "mlp.py", line 91, in load_data dataset = get_dataset(root=datadir, train=True, download=True, transform=tr_transform) File "/opt/conda/envs/caliban/lib/python3.7/site-packages/torchvision/datasets/mnist.py", line 79, in __init__ self.download() File "/opt/conda/envs/caliban/lib/python3.7/site-packages/torchvision/datasets/mnist.py", line 146, in download download_and_extract_archive(url, download_root=self.raw_folder, filename=filename, md5=md5) File "/opt/conda/envs/caliban/lib/python3.7/site-packages/torchvision/datasets/utils.py", line 256, in download_and_extract_archive download_url(url, download_root, filename, md5) File "/opt/conda/envs/caliban/lib/python3.7/site-packages/torchvision/datasets/utils.py", line 84, in download_url raise e File "/opt/conda/envs/caliban/lib/python3.7/site-packages/torchvision/datasets/utils.py", line 72, in download_url reporthook=gen_bar_updater() File "/opt/conda/envs/caliban/lib/python3.7/urllib/request.py", line 247, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "/opt/conda/envs/caliban/lib/python3.7/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/opt/conda/envs/caliban/lib/python3.7/urllib/request.py", line 531, in open response = meth(req, response) File "/opt/conda/envs/caliban/lib/python3.7/urllib/request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "/opt/conda/envs/caliban/lib/python3.7/urllib/request.py", line 569, in error return self._call_chain(*args) File "/opt/conda/envs/caliban/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(*args) File "/opt/conda/envs/caliban/lib/python3.7/urllib/request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden

rahimentezari commented 3 years ago

That is a problem with MNIST: https://github.com/pytorch/vision/issues/1938

sritchie commented 3 years ago

Ah, nice, thanks for the followup note, @rahimentezari !

rahimentezari commented 3 years ago

If above solution is not working this is another solution:

    os.system("wget www.di.ens.fr/~lelarge/MNIST.tar.gz")
    os.system("tar -xvzf MNIST.tar.gz")

    from torchvision.datasets import MNIST
    from torchvision import transforms

    normalize = transforms.Normalize(mean=[0.131], std=[0.289])
    train_loader = torch.utils.data.DataLoader(
        MNIST(root='./', download=False, transform=transforms.Compose([transforms.ToTensor(),
            normalize,
        ]), train=True),
        batch_size=args.batchsize, shuffle=True,
        num_workers=args.workers, pin_memory=True)

    val_loader = torch.utils.data.DataLoader(
        MNIST(root='./', download=False, transform=transforms.Compose([transforms.ToTensor(),
            normalize,
        ]), train=False),
        batch_size=args.batchsize, shuffle=True,
        num_workers=args.workers, pin_memory=True)