DEV Community

satish
satish

Posted on

Pytorch MNIST Dataset Error

There seems to be some problem with the Hosting, and the Pytorch team is solving the following issue.

Use this code to solve the issue. It provides a new mirror to download the dataset.

from torchvision import datasets,transforms
new_mirror = 'https://ossci-datasets.s3.amazonaws.com/mnist'
datasets.MNIST.resources = [
   ('/'.join([new_mirror, url.split('/')[-1]]), md5)
   for url, md5 in datasets.MNIST.resources
]
train_dataset = datasets.MNIST(
   "../data", train=True, download=True, transform=transforms.Totensor()
)
Enter fullscreen mode Exit fullscreen mode

Courtesy: https://stackoverflow.com/questions/66577151/http-error-when-trying-to-download-mnist-data

Latest comments (0)