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

心不动则不痛 提交于 2019-12-10 22:47:18

问题


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])

回答1:


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")



来源:https://stackoverflow.com/questions/57220347/attributeerror-when-using-callback-tensorboard-on-keras-model-object-has-no-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!