gpt4 book ai didi

python - 使用 TensorFlow 作为依赖项部署 Google Cloud Functions

转载 作者:太空宇宙 更新时间:2023-11-03 13:58:34 25 4
gpt4 key购买 nike

我想使用 Google Cloud Functions 部署一个以 JSON 格式保存的 keras 模型(包括 HDF5 中的权重),并将 tensorflow 作为后端。

当我在 requirements.txt 中没有指定 tensorflow 时部署成功。虽然在 GCP 中测试该功能时,我收到错误消息,指出找不到 tensorflow。

Error: function crashed. Details:
No module named 'tensorflow'

首先,我觉得很奇怪 Google 没有提供预装 tensorflow 的环境。

但现在如果我在 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))

有没有办法让我在 Cloud Functions 上获取 tensorflow 或 Google 故意阻止安装以让我们使用 ML Engine?

最佳答案

编辑: Tensorflow 1.13.1 now supports Python 3.7.


上一个答案:

目前无法在 Google Cloud Functions 上使用 tensorflow

然而,这并不是因为 Google 故意阻止它:tensorflow package仅提供 CPython 2.7、3.3、3.4、3.5 和 3.6 的内置发行版,但 the Cloud Functions Python runtime is based on Python version 3.7.0 , 所以 pip (正确地)找不到任何兼容的发行版。

目前有some compatibility issues with TensorFlow and Python 3.7 ,但一旦修复,tensorflow 应该可以安装在 Google Cloud Functions 上。不过现在,您必须使用 ML 引擎。

关于python - 使用 TensorFlow 作为依赖项部署 Google Cloud Functions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52226691/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com