问题描述
我使用 Keras 的函数式 API 构建了一个模型,当我将 tensorboard 实例添加到我的 model.fit() 函数中的回调时,它抛出一个错误:"AttributeError: 'Model' object没有属性 '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?
张量流: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])
推荐答案
I got the same error : 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.
确保按如下方式导入张量板:
从 keras.callbacks 导入 TensorBoard
像这样更改日志目录:tensorboard = TensorBoard(log_dir="logs")
这篇关于在 Keras 上使用回调 Tensorboard 时出现 AttributeError:'Model'对象没有属性 'run_eagerly'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!