Ale*_*vet 3 python deployment keras tensorflow google-cloud-functions
我想使用Google Cloud Functions来部署以JSON格式保存的keras模型(包括HDF5中的权重),并将tensorflow作为后端.
当我没有在requirements.txt中指定tensorflow时,部署成功.虽然在GCP中测试函数时,我收到错误消息,指出无法找到tensorflow.
Error: function crashed. Details:
No module named 'tensorflow'
Run Code Online (Sandbox Code Playgroud)
首先,我发现谷歌没有提供预先安装张量流的环境,这很奇怪.
但是现在,如果我在requirements.txt中指定了tensorflow,则部署将失败并显示错误消息
ERROR: (gcloud.beta.functions.deploy) OperationError:
code=3, message=Build failed: USER ERROR:
`pip_download_wheels` had stderr output:
Could not find a version that satisfies the
requirement tensorflow (from -r /dev/stdin (line 5))
(from versions: )
No matching distribution found for tensorflow (from -r
/dev/stdin (line 5))
Run Code Online (Sandbox Code Playgroud)
有没有办法让我可以在云功能上获得张量流,或谷歌故意阻止安装让我们使用ML引擎?
编辑: Tensorflow 1.13.1现在支持Python 3.7.
上一个答案:
目前没有办法tensorflow在Google云端功能上使用.
然而,并不是因为谷歌故意阻止它:该tensorflow软件包仅为CPython 2.7,3.3,3.4,3.5和3.6提供内置发行版,但Cloud Functions Python运行时基于Python版本3.7.0,因此pip(正确)可以'找到任何兼容的发行版.
目前TensorFlow和Python 3.7存在一些兼容性问题,但一旦修复,tensorflow应该可以安装在Google Cloud Functions上.但就目前而言,你必须使用ML引擎.