DEV Community

loading...

Pytorch MNIST Dataset Error

satish
・1 min read

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

Discussion (0)