How to call and train MNIST Dataset?

How do direct to the local root and/or online root for MNIST dataset to train and transform it? I downloaded MNIST onto my harddrive here: MNIST_dataset | Kaggle

I tried this but it is getting an error?
train_data =datasets.MNIST(
root = ‘data’,
train = True,
transform = ToTensor(),
download = True
)

Point the root argument to the location where your MNIST dataset is stored and use download=False.

How do I do that with code?

mnist_root = your/mnist/path
train_data = datasets.MNIST(
root = mnist_root,
train = True,
transform = ToTensor(),
download = False
)

If you are using Linux, navigate through the terminal to the folder where the data is stored and run pwd. The path will be returned, just copy that and paste in root=’ '.
Or you can move the folder to the directory you are working and create the folder “data” and move it in.

@foti and @Eduardo_Lawson - I am using Windows.

Perhaps the issue is the file structure? I have tried every combination of zip files, test, train data, etc. and also root folders. Should the MNIST data be in a zip file?

Just download the dataset via download=True, as already mentioned, and check the structure:

import torch
import torchvision.datasets as datasets

dataset = datasets.MNIST(
        root="./",
        train=True,
        download=True,
)
tree 
.
├── MNIST
│   └── raw
│       ├── t10k-images-idx3-ubyte
│       ├── t10k-images-idx3-ubyte.gz
│       ├── t10k-labels-idx1-ubyte
│       ├── t10k-labels-idx1-ubyte.gz
│       ├── train-images-idx3-ubyte
│       ├── train-images-idx3-ubyte.gz
│       ├── train-labels-idx1-ubyte
│       └── train-labels-idx1-ubyte.gz
└── tmp.py

I don’t know why you want to download the dataset manually instead of letting datasets.MNIST do it.