Problems downloading the official MNIST data set? Here is a workaround!

Photo by Markus Spiske on Unsplash

⛔️ The problem

Some of you might have tried to download the MNIST data set (for PyTorch) recently…

Example code showing how to normally download the MNIST torchvision data set

… only to discover that you get the following error:

urllib.error.HTTPError: HTTP Error 503: Service Unavailable

It looks like Yann LeCun, who hosts the data set, added some Basic Auth login to his private website, which seems to be the root cause of the 503 error:

Screenshot of the Basic Auth login window showing up when trying to access http://yann.lecun.com

✅️ The workaround

I found another website hosting the MNIST data set and wrote a bit of code which downloads it and brings it into the correct format for using it as a torchvision data set:

In case you are not using PyTorch you can probably still make use of the code up until line 31 for downloading and unzipping the MNIST files.

Hope this helps someone save some time 🙂️

--

--

Stefanie Stoppel

I’m a Machine Learning Engineer and Software Developer. I like automating ML workflows and care about bias, fairness & explainability in AI.