在Keras上使用回调Tensorboard时发生AttributeError:“模型"对象没有属性"run_eagerly" [英] AttributeError when using callback Tensorboard on Keras: 'Model' object has no attribute 'run_eagerly'
问题描述
我已经使用Keras的功能API构建了一个模型,当我在我的model.fit()函数的回调中添加tensorboard实例时,它会引发错误:"AttributeError: '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'"
Model类确实没有run_eagerly属性,但是在Keras文档中,它说可以将其作为参数传递给model.compile()函数.这将返回
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']))"
这是否意味着我没有合适的Tensorflow/Keras版本?
Does this mean I don't have a suitable version of Tensorflow/Keras?
Tensorflow:1.14.0
Tensorflow: 1.14.0
Keras:2.2.4-tf
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])
推荐答案
我遇到了相同的错误:AttributeError: 'Model' object has no attribute 'run_eagerly'
I got the same error : AttributeError: 'Model' object has no attribute 'run_eagerly'
在进行了两次较小的更改后,我的张量板现在正在运行.
After two minor changes my tensorboard is running now.
-
确保按以下方式导入张量板:
from keras.callbacks import TensorBoard
make sure you import tensorboard as follows:
from keras.callbacks import TensorBoard
像这样更改日志目录:
tensorboard = TensorBoard(log_dir="logs")
change the log dir like this:
tensorboard = TensorBoard(log_dir="logs")
这篇关于在Keras上使用回调Tensorboard时发生AttributeError:“模型"对象没有属性"run_eagerly"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!