Heroku : tensorflow 2.2.1 too large for deployment

那年仲夏 提交于 2020-07-22 03:54:51

问题


im trying to deploy a keras project to heroku but pushing to the repository master branch seems to be problematic for me as the following error is reported every time I try it:

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 ...

I figured this is due to the tensorflow requirement being way too large for heroku to handle, as git count-objects -vH reports a more modest size for my project:

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

I have offloaded unneeded files and compressed my repo as much as I could...

The only way for my app to be uploaded is to remove tensorflow from requirements.txt but then my app would not run... The same is true if I downgrade to an earlier version of tensorflow as others have suggested. Is it possible to deploy a project such as this using heroku ?


回答1:


Turns out the Tensorflow 2.0 module is very large (more than 500MB, the limit for Heroku) because of its GPU support. Since Heroku doesn't support GPU, it doesn't make sense to install the module with GPU support.

Solution:

Simply replace tensorflow with tensorflow-cpu in your requirements.

This worked for me, hope it works for you too!



来源:https://stackoverflow.com/questions/61796196/heroku-tensorflow-2-2-1-too-large-for-deployment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!