Heroku:Tensorflow 2.2.1太大而无法部署 [英] Heroku : tensorflow 2.2.1 too large for deployment

查看:124
本文介绍了Heroku:Tensorflow 2.2.1太大而无法部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

我认为这是由于tensorflow要求对于heroku而言太大可以处理,因为 git count-objects -vH 报告我的项目的大小更适中:

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

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

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 ?

推荐答案

结果证明Tensorflow 2.0模块非常大( 500MB(Heroku的限制)),因为它支持GPU。由于Heroku不支持GPU,因此没有必要安装具有GPU支持的模块。

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.

在您的需求中将 tensorflow 替换为 tensorflow-cpu

Simply replace tensorflow with tensorflow-cpu in your requirements.

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

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

这篇关于Heroku:Tensorflow 2.2.1太大而无法部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆