Tensorflow依赖性导致Heroku应用超出最大子弹大小

问题描述

我正在Heroku上部署一个具有tensorflow作为依赖项的应用程序,但是安装tensorflow会导致它超过最大块大小(上限为500M)。我知道这一点是因为我可以在requirements.txt中不使用tensorflow进行推送。 Heroku文档说使用.slugignore文件忽略静态文件或未使用的依赖项,但是绝对需要tensorflow否则该应用程序将无法实际运行...我必须包含它。我该如何解决?

remote: -----> Compressing...
remote:  !     Compiled slug size: 610.3M 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 safe-fjord-13722.
remote: 
To https://git.heroku.com/safe-fjord-13722.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/safe-fjord-13722.git

解决方法

如果在将深度学习模型部署到Heroku时仍然遇到问题,请务必记住TensorFlow 2.0约有500 MB,而早期版本要小得多。使用先前版本的TensorFlow会大大减少弹头的大小。尝试使用TensorFlow 1,它将使您的模型尺寸减少50%或更多

如此处所述,塞子大小限制为500MB:https://devcenter.heroku.com/articles/slug-compiler#slug-size

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...