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)。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…