1. ensorflow.python.framework.errors_impl.FailedPreconditionError: Error while reading resource variable softmax/kernel from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/softmax/kernel/N10tensorflow3VarE does not exist.
最近在使用flask部署keras服务的时候。遇到改错误,看错误,感觉是变量没有初始化,百度各种资料,成功找到解决办法。
creating a reference to the session that is used for loading the models and then to set it to be used by keras in each request
在加载模型之前,创建session。并在模型调用predict的时候,设置同样的session。保证整个项目使用模型使用同一个session。成功解决问题。
1 | from tensorflow.python.keras.backend import set_session |
在调用的时候,如下设置。
1 | global sess |
参考:
https://github.com/tensorflow/tensorflow/issues/28287
https://www.datalearner.com/blog/1051572578207468
2. XLA_GPU
解决办法:
sudo chmod -R a+r /usr/local/cuda*