tensorflow - Heroku : tensorflow 2. 2.1 太大,无法部署

标签 tensorflow heroku keras deployment tensorflow2.0

我试图将 keras 项目部署到 heroku 但推送到存储库主分支对我来说似乎有问题,因为每次尝试时都会报告以下错误:

remote: -----> Compressing...
remote:  !     Compiled slug size: 836M is too large (max is 500M).
remote:  !     See: http://devcenter.heroku.com/articles/slug-size
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to ...

我认为这是由于 tensorflow 要求对于 heroku 来说太大而无法处理,如 git count-objects -vH为我的项目报告了一个更适中的大小:
count: 1
size: 4.00 KiB
in-pack: 9146
packs: 1
size-pack: 177.42 MiB
prune-packable: 0
garbage: 0
size-garbage: 0 bytes

我已经卸载了不需要的文件并尽可能多地压缩了我的仓库......

上传我的应用程序的唯一方法是从 requirements.txt 中删除 tensorflow,但随后我的应用程序将无法运行......如果我按照其他人的建议降级到早期版本的 tensorflow,情况也是如此。是否可以使用 heroku 部署这样的项目?

最佳答案

事实证明,Tensorflow 2.0 模块非常大(超过 500MB,Heroku 的限制),因为它支持 GPU。由于 Heroku 不支持 GPU,因此安装支持 GPU 的模块是没有意义的。

解决方案:

只需更换 tensorflow tensorflow 处理器 在您的要求中。

这对我有用,希望它也对你有用!

关于tensorflow - Heroku : tensorflow 2. 2.1 太大,无法部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61796196/

相关文章:

node.js - heroku 服务器上的幽灵博客密码验证失败

ruby - 如何在没有默认凭据文件的情况下授权 Google 服务帐户?

python - SciKit-learn 网格搜索自己的评分对象语法

python - Keras 中的输入和输出维度错误

python - 是否在 Imagedatagenerator 中将 class_mode 从二进制更改为分类模式感到困惑

python - 如何根据神经网络预测改变pygame中的事件

python - 类型错误 : Input 'b' of 'MatMul' Op has type float32 that does not match type int32 of argument 'a'

python - 如何在keras层中使用SVD?

python - 删除 tf.dataset 管道中输入字符串的重音

heroku - 使用 Anaconda 和 OpenCV 将 Docker 应用程序部署到 Heroku 时出现 "Could not find a version that satisfies the requirement cv2==1.0"