Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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])
like image 295
Alexander Schmiedl Avatar asked Jul 26 '19 12:07

Alexander Schmiedl


2 Answers

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

like image 61
bunu Avatar answered Oct 24 '22 06:10

bunu


I got same error message when I use: from tensorflow.keras.callbacks import ModelCheckpoint I fix it with by importing the same as: from keras.callbacks.callbacks import ModelCheckpoint

like image 1
maruthi_gali Avatar answered Oct 24 '22 05:10

maruthi_gali