我有一个keras顺序模型,在模型训练期间可以很好地工作,但是当我尝试在训练后的模型上运行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'
我已经搜索了此错误,但是找不到任何解决方案。 有人知道对此有任何解决办法吗?
答案 0 :(得分:1)
我知道此错误的原因:
我的docker容器自动安装了最新的keras版本,该版本已更改为2.3.0(新的稳定版本),直到上周才可用,因此以前我的容器运行良好。 Keras新的稳定版本:2.3.0可能与Gevent有关,导致了此冲突。
我卸载了keras并安装了2.2.5版本,该版本解决了该错误。
pip uninstall keras
pip install keras==2.2.5