我有一个 keras Sequential 模型,它在模型训练期间运行得非常好,但是当我尝试在训练模型上运行 model.predict 命令时,
我收到以下错误:-
Traceback (most recent call last):
File "/opt/program/predictor.py", line 69, in predict
a=model.predict(x_input, verbose=0)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1456, in predict
self._make_predict_function()
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 378, in _make_predict_function
**kwargs)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/network.py", line 323, in __setattr__
super(Network, self).__setattr__(name, value)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/base_layer.py", line 1215, in __setattr__
if not _DISABLE_TRACKING.value:
File "src/gevent/local.py", line 408, in gevent._local.local.__getattribute__
AttributeError: 'gevent._local.local' object has no attribute 'value'
我已经搜索过这个错误,但找不到任何解决方案。 有谁知道解决这个问题的办法吗?
请您参考如下方法:
我得到了这个错误的原因:
我的 docker 容器自动安装最新的 keras 版本,该版本已更改为 2.3.0(新的稳定版本),直到上周才可用,因此我的容器之前运行良好。 Keras 新的稳定版本:2.3.0 可能与导致此冲突的 Gevent 存在一些问题。
我卸载了 keras 并安装了 2.2.5 版本解决了错误。
pip uninstall keras
pip install keras==2.2.5
