単一レイヤーネットワークを作成しようとしています。それはmodel.fit
を通じて訓練を開始すると、いくつかのランダムな時代で、それは次のようなエラーがスローされます。Keras ValueError:閉じたファイルの入出力操作
ValueError: I/O operation on closed file
ここで私はmodel.fit
my_model = model.fit(train_x, train_y, batch_size=100, nb_epoch=20, show_accuracy=True, verbose=1)
を使用しています場合は私に知らせてください方法です何か考えているか、同じ問題に遭遇している。質問のコメントで述べたように、これは実際にIPythonのバグが原因で、(今までは表示されませんでした)
Epoch 1/20
47900/60816 [======================>.......] - ETA: 3s - loss: 0.1688 - acc: 0.9594
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-273f2082a322> in <module>()
14 model.compile(loss='binary_crossentropy', optimizer='adadelta')
15
---> 16 model.fit(train_x, train_y, batch_size=100, nb_epoch=20, show_accuracy=True, verbose=1)
17 score = model.evaluate(test_x, test_y, show_accuracy=True, verbose=0)
18 print('Test loss:', score[0])
/usr/local/lib/python2.7/dist-packages/keras/models.pyc in fit(self, X, y, batch_size, nb_epoch, verbose, callbacks, validation_split, validation_data, shuffle, show_accuracy, class_weight, sample_weight)
699 verbose=verbose, callbacks=callbacks,
700 val_f=val_f, val_ins=val_ins,
--> 701 shuffle=shuffle, metrics=metrics)
702
703 def predict(self, X, batch_size=128, verbose=0):
/usr/local/lib/python2.7/dist-packages/keras/models.pyc in _fit(self, f, ins, out_labels, batch_size, nb_epoch, verbose, callbacks, val_f, val_ins, shuffle, metrics)
321 batch_logs[l] = o
322
--> 323 callbacks.on_batch_end(batch_index, batch_logs)
324
325 epoch_logs = {}
/usr/local/lib/python2.7/dist-packages/keras/callbacks.pyc in on_batch_end(self, batch, logs)
58 t_before_callbacks = time.time()
59 for callback in self.callbacks:
---> 60 callback.on_batch_end(batch, logs)
61 self._delta_ts_batch_end.append(time.time() - t_before_callbacks)
62 delta_t_median = np.median(self._delta_ts_batch_end)
/usr/local/lib/python2.7/dist-packages/keras/callbacks.pyc in on_batch_end(self, batch, logs)
187 # will be handled by on_epoch_end
188 if self.verbose and self.seen < self.params['nb_sample']:
--> 189 self.progbar.update(self.seen, self.log_values)
190
191 def on_epoch_end(self, epoch, logs={}):
/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.pyc in update(self, current, values)
59 prev_total_width = self.total_width
60 sys.stdout.write("\b" * prev_total_width)
---> 61 sys.stdout.write("\r")
62
63 numdigits = int(np.floor(np.log10(self.target))) + 1
/usr/local/lib/python2.7/dist-packages/ipykernel/iostream.pyc in write(self, string)
315
316 is_child = (not self._is_master_process())
--> 317 self._buffer.write(string)
318 if is_child:
319 # newlines imply flush in subprocesses
ValueError: I/O operation on closed file
冗長レベルをverbose = 0に変更すると問題は解決しますか? https://github.com/fchollet/keras/issues/2110 –