DEV Community


Pytorch MNIST Dataset Error

・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 = ''
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


Discussion (0)