Heroku:tensorflow 2.2.1 太大,无法部署

Απο*_*λου 8 deployment heroku keras tensorflow tensorflow2.0

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

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 ...
Run Code Online (Sandbox Code Playgroud)

我认为这是由于 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
Run Code Online (Sandbox Code Playgroud)

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

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

小智 14

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

解决方案:

只需更换tensorflow与tensorflow-CPU在您的要求。

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