我试图将 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/