Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
540 views
in Technique[技术] by (71.8m points)

python - Heroku:安装Pytorch之后,子弹尺寸太大(Heroku: slug size too large after installing Pytorch)

I've been getting the slug size too large warning ( Compiled slug size: 789.8M is too large (max is 500M) ) from Heroku and I can't figure out why, as my model size (cnn.pth below) is fairly small and my file directory is only 1.1mb in total: screenshot of directory.

(我从Heroku Compiled slug size: 789.8M is too large (max is 500M)尺寸过大的警告(已Compiled slug size: 789.8M is too large (max is 500M) ),我不知道为什么,因为我的模型尺寸(下面的cnn.pth)相当很小,我的文件目录总共只有1.1mb: 目录的屏幕快照。)

It seems like the size increase is caused by running pipenv install torch , as the slug size was 89.1mb before installing torch and 798.8mb after.

(似乎大小增加是由运行pipenv install torch引起的,因为在安装torch之前,子弹大小为89.1mb,而在安装torch ,子弹大小为798.8mb。)

My Pipfile currently has these packages installed:

(我的Pipfile当前安装了以下软件包:)

[packages]
flask = "*"
flask-sqlalchemy = "*"
psycopg2 = "*"
psycopg2-binary = "*"
requests = "*"
numpy = "*"
gunicorn = "*"
pillow = "*"
torch = "*"

Is there any workaround for this?

(有什么解决方法吗?)

Edit: I'm running Mac OSX 10.10.5, using Flask and pipenv .

(编辑:我正在使用Flaskpipenv运行Mac OSX pipenv 。)

  ask by zeniale translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The pytorch package that you're installing comes with both cpu and gpu support, thus has a large size.

(您要安装的pytorch软件包同时具有cpu和gpu支持,因此尺寸较大。)

It seems you're using the free version of heroku, and only require the cpu support.

(看来您使用的是Heroku的免费版本,并且只需要cpu支持。)

The solution is to install the pytorch package for cpu only ie

(解决方案是仅为cpu安装pytorch软件包,即)

In requirements.txt , write the wheel file path corresponding to the version of pytorch (cpu) that you're interested in. You can find the list of wheel files , which can be installed with pip .

(在requirements.txt ,输入与您感兴趣的pytorch(cpu)版本相对应的wheel文件路径。您可以找到wheel文件列表 ,可以使用pip进行安装。)

For example, for PyTorch 1.3.1, torchvision 0.4.2, Python 3.7, Linux, you can write the following for pytorch and torchvision respectively:

(例如,对于PyTorch 1.3.1,torchvision 0.4.2,Python 3.7,Linux,您可以分别为pytorch和torchvision编写以下代码:)

https://download.pytorch.org/whl/cpu/torch-1.3.1%2Bcpu-cp37-cp37m-linux_x86_64.whl
https://download.pytorch.org/whl/cpu/torchvision-0.4.2%2Bcpu-cp37-cp37m-linux_x86_64.whl

The above will download torch-1.3.1+cpu-cp37-cp37m-linux_x86_64.whl (107MB) torchvision-0.4.2+cpu-cp37-cp37m-linux_x86_64.whl (13MB) respectively.

(以上将分别下载torch-1.3.1+cpu-cp37-cp37m-linux_x86_64.whl (107MB) torchvision-0.4.2+cpu-cp37-cp37m-linux_x86_64.whl (13MB)。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...