keras的坑1

Keras ValueError: I/O operation on closed file.

解决办法1:

As mentioned in the question comments (didn't see until just now), this is actually due to a bug in IPython/Jupyter IO and how it handles the verbose output from Keras. You can disable reporting by setting verbose=False on the train and predict or predict_proba methods invoked on the model as a workaround in the mean time, or just run the model outside of the notebook.

解决办法2:

I got the same problem and had it fixed now. By setting verbose = 2 in model.fit can help to solve this problem. In Keras document for model.fit, you can find this: "verbose: 0 for no logging to stdout, 1 for progress bar logging, 2 for one log line per epoch.". Setting verbose = 2 will update the progress after each epoch, and help to reduce the amount of logging information output to the screen, which i guess caused the IO closed problem. Some people suggest to set verbose = 0 to disable the output but in that case we can't track the progress. I hope this can help to solve your problem as well.

https://github.com/keras-team/keras/issues/2110

你可能感兴趣的:(keras的坑1)