MNIST expects a specific format, so you would need to store your data in the same format and name accordingly.
The usual approach would be to e.g. use ImageFolder, if you are loading single image files, or a custom Dataset.
What kind of data do you have?