问题
I have started with deep learning with Theano and Keras. However, for any program, I will have to load the dataset, and i'm not able to load any dataset.
Even if I run these two lines:-
from keras.datasets import cifar10
(X_train, y_train), (X_test, y_test) = cifar10.load_data()
I even tried the above with minst dataset. Exact same error.
I tried to run the commands one by one, the first import goes well. In the second command, it runs and python begins downloading. However, after a few seconds, it breaks.
This is the exact error:-
(X_train, y_train), (X_test, y_test) = cifar10.load_data() Downloading data from http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz
8929280/170498071 [>.............................] - ETA: 82sTraceback (most recent call last):File "", line 1, in (X_train, y_train), (X_test, y_test) = cifar10.load_data()
File "C:\Users\Aseem\Anaconda3\envs\AnacondaAseem\lib\site-packages\keras\datasets\cifar10.py", line 11, in load_data path = get_file(dirname, origin=origin, untar=True)
File "C:\Users\Aseem\Anaconda3\envs\AnacondaAseem\lib\site-packages\keras\utils\data_utils.py", line 76, in get_file raise e
ValueError: I/O operation on closed file
I do not know why this is happening. Seems like something is wrong in the file data_utils.py
What do I do?
回答1:
I tried your exact code and it works fine on my computer. The failure could be due to several reasons, like a unstable internet connection or not enough free space in your home folder.
What you can do is to download the file manually using a download manager, put it in ~/.keras/datasets and rename it to cifar-10-batches-py.tar.gz and run the code again, it should pick up the file and continue processing from there.
来源:https://stackoverflow.com/questions/36805640/this-error-while-downloading-datasets-valueerror-i-o-operation-on-closed-file