Heroku:Tensorflow 2.2.1太大而无法部署

编程入门 行业动态 更新时间:2024-10-27 09:45:32
本文介绍了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: devcenter.heroku/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太大而无法部署

本文发布于:2023-10-28 02:10:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535197.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:太大   Heroku   Tensorflow

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!