tensorflow - Heroku:张量流 2.2.1 太大而无法部署
问题描述
我试图将 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 -cpu。
这对我有用,希望它也对你有用!
推荐阅读
- javascript - 在自定义 jquery 函数中重复淡入/淡出,避免间隔或超时
- python - 有没有办法让这个算法变得更干净或更好看?(等级/平均计算器)
- android - 如何使用 viewpager2 实现这一点?
- python - Django 3.0 表单:表单错误未显示在模板上
- python - Q:Pygame 如何让我的关卡在玩家移动时左右滚动?
- javascript - 无法在 .then() 之外更改外部变量
- python - 使用 Beautiful Soup 进行网页抓取,无法从 application/json 数据中获取序列化日期和其他键值对
- python - python套接字应该有多快?为什么我的运行速度很慢?
- rest - 在使用 Web 服务 xamarin 时显示选择器项目
- mysql - 升级到 Ubuntu 20.04 (rails) 后无法再连接到 RDS MySQL