Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EOFError: Compressed file ended before the end-of-stream marker was reached - MNIST data set

I am getting the following error when I run mnist = input_data.read_data_sets("MNIST_data", one_hot = True).

EOFError: Compressed file ended before the end-of-stream marker was reached

Even when I extract the file manually and place it in the MNIST_data directory, the program is still trying to download the file instead of using the extracted file.

When I extract the file using WinZip which is the manual way, WinZip tells me that the file is corrupt.

How do I solve this problem?

I can't even load the data set now, I still have to debug the program itself. Please help.

I pip installed Tensorflow and so I don't have a Tensorflow example. So I went to GitHub to get the input_data file and saved it in the same directory as my main.py. The error is just regarding the .gz file. The program could not extract it.

runfile('C:/Users/Nikhil/Desktop/Tensor Flow/tensf.py', wdir='C:/Users/Nikhil/Desktop/Tensor Flow') Reloaded modules: input_data Extracting MNIST_data/train-images-idx3-ubyte.gz C:\Users\Nikhil\Anaconda3\lib\gzip.py:274: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future return self._buffer.read(size) Traceback (most recent call last):

File "", line 1, in runfile('C:/Users/Nikhil/Desktop/Tensor Flow/tensf.py', wdir='C:/Users/Nikhil/Desktop/Tensor Flow')

File "C:\Users\Nikhil\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace)

File "C:\Users\Nikhil\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Nikhil/Desktop/Tensor Flow/tensf.py", line 26, in mnist = input_data.read_data_sets("MNIST_data/", one_hot = True)

File "C:\Users\Nikhil\Desktop\Tensor Flow\input_data.py", line 181, in read_data_sets train_images = extract_images(local_file)

File "C:\Users\Nikhil\Desktop\Tensor Flow\input_data.py", line 60, in extract_images buf = bytestream.read(rows * cols * num_images)

File "C:\Users\Nikhil\Anaconda3\lib\gzip.py", line 274, in read return self._buffer.read(size)

File "C:\Users\Nikhil\Anaconda3\lib_compression.py", line 68, in readinto data = self.read(len(byte_view))

File "C:\Users\Nikhil\Anaconda3\lib\gzip.py", line 480, in read raise EOFError("Compressed file ended before the "

EOFError: Compressed file ended before the end-of-stream marker was reached

like image 778
Nikhil Raghavendra Avatar asked Nov 29 '16 23:11

Nikhil Raghavendra


1 Answers

This is because for some reason you have an incomplete download for the MNIST dataset.

You will have to manually delete the downloaded folder which usually resides in ~/.keras/datasets or any path specified by you relative to this path, in your case MNIST_data.

Perform the following steps in the terminal (ctrl + alt + t):

  1. cd ~/.keras/datasets/
  2. rm -rf "dataset name"

You should be good to go!

like image 160
Payas Pandey Avatar answered Sep 21 '22 09:09

Payas Pandey