Python Tensorflow在保存数据时崩溃

时间:2018-11-03 00:57:33

标签: python tensorflow

我制作了一个Python脚本,并且几乎可以正常使用,我在脚本末尾使用了以下代码:

filepath = "RNN_Final-{epoch:02d }-{val_acc:.3f}"

#Saves only the best ones
checkpoint = ModelCheckpoint("models/{}.model".format(filepath, monitor='val_acc', verbose=1, save_best_only=True, mode='max'))

history = model.fit(
    train_x, train_y,
    batch_size=BATCH_SIZE,
    epochs=EPOCHS,
    validation_data=(validation_x, validation_y),
    callbacks=[tensorboard, checkpoint])

这是我得到的错误:

File "/var/www/test.nl/test.py", line 162, in <module>
    callbacks=[tensorboard, checkpoint])
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/keras/engine/training.py", line 1605, in fit
    validation_steps=validation_steps)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/keras/engine/training_arrays.py", line 238, in fit_loop
    callbacks.on_epoch_end(epoch, epoch_logs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/keras/callbacks.py", line 214, in on_epoch_end
    callback.on_epoch_end(epoch, logs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/keras/callbacks.py", line 568, in on_epoch_end
    filepath = self.filepath.format(epoch=epoch + 1, **logs)
ValueError: Invalid conversion specification

脚本在此行崩溃:

callbacks=[tensorboard, checkpoint])

我该怎么办,或者我做错了什么?

0 个答案:

没有答案