Keras: EOFError, loading MNIST data

Created on 1 May 2016  路  9Comments  路  Source: keras-team/keras

I get the following error when running the script under examples/mnist_cnn (https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py):

line 337, in
...(X_train, y_train), (X_test, y_test) = mnist.load_data()
File "C:\Users\Colin\Miniconda3\lib\site-packages\keras\datasets\mnist.py", line 19, in load_data
...data = cPickle.load(f, encoding="bytes")
File "C:\Users\Colin\Miniconda3\libgzip.py", line 596, in readline
...c = self.read(readsize)
File "C:\Users\Colin\Miniconda3\libgzip.py", line 365, in read
...if not self._read(readsize):
File "C:\Users\Colin\Miniconda3\libgzip.py", line 449, in _read
...self._read_eof()
File "C:\Users\Colin\Miniconda3\libgzip.py", line 482, in _read_eof
...crc32, isize = struct.unpack(" File "C:\Users\Colin\Miniconda3\libgzip.py", line 286, in _read_exact
...raise EOFError("Compressed file ended before the "
EOFError: Compressed file ended before the end-of-stream marker was reached

I'm running the latest Theano and Keras, Python 3.4.

Most helpful comment

Probably due to in-completed download file, try to remove downloaded file (usually in ~/.keras/ or /tmp/.keras/) and run again.

All 9 comments

Similar problem in #2519 -- same module (gzip) but different errors.

Probably due to in-completed download file, try to remove downloaded file (usually in ~/.keras/ or /tmp/.keras/) and run again.

Works now. I deleted mnist.pkl in /.keras/datasets/. Thanks!

Where is the ~/.keras/ path? I can't find this folder.

@laubonghaudoi if you're using windows.. simply use PowerShell instead of comand prompt and type:cd ~/.keras/datasets

You should also be able to navigate using explorer to the .keras folder located in your username folder. However, I find that PowerShell is easier (if you installed keras correctly).

You can also manually download mnist-dataset from https://s3.amazonaws.com/img-datasets/mnist.pkl.gz and put it into ~/.keras/datasets .

Hi passim, i am on a mac. I have a hard time auto download the file because it keeps timing it out. so I manually download it. now I have the file .keras/datasets/mnist.npz in the .keras dirctory. it's still not loading from the file, and it keeps want to auto download from https:/......

do i need to change the path name? thanks for helping.

i figured it out. i used a different IDE to download the datasets.

I solved by restarting my computer...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kylemcdonald picture kylemcdonald  路  3Comments

farizrahman4u picture farizrahman4u  路  3Comments

amityaffliction picture amityaffliction  路  3Comments

LuCeHe picture LuCeHe  路  3Comments

KeironO picture KeironO  路  3Comments