简体   繁体   中英

AttributeError when using callback Tensorboard on Keras: 'Model' object has no attribute 'run_eagerly'

I have built a model using the functional API from Keras, and when I am adding the tensorboard instance to my callbacks in my model.fit() function, it throws an Error: "AttributeError: 'Model' object has no attribute 'run_eagerly'"

The Model class does indeed not have an attribute run_eagerly, but in the Keras doc, it says that it can be passed as parameter to the model.compile() function. This returns

"ValueError: ('Some keys in session_kwargs are not supported at this time: %s', dict_keys(['run_eagerly']))"

Does this mean I don't have a suitable version of Tensorflow/Keras?

Tensorflow: 1.14.0

Keras: 2.2.4-tf

model = Model(inputs=[input_ant1, input_ant2], outputs=main_output)

tensorboard = TensorBoard(log_dir='.logs/'.format(time()))

[...]

model.fit([input1, input2],[labels], epochs=10, callbacks=[tensorboard])

I got the same error : AttributeError: 'Model' object has no attribute 'run_eagerly'

After two minor changes my tensorboard is running now.

  1. make sure you import tensorboard as follows: from keras.callbacks import TensorBoard

  2. change the log dir like this: tensorboard = TensorBoard(log_dir="logs")

我在使用时收到相同的错误消息: from tensorflow.keras.callbacks import ModelCheckpoint我通过导入相同的内容来修复它: from keras.callbacks.callbacks import ModelCheckpoint

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM