pytorch package too huge
Asked Answered
I

1

8

After installing pytorch via

RUN python3 -m pip install --no-cache-dir torch==1.9.1

I realised that corresponding docker layer is 1.78GB Is there any way to reduce pytorch size? Current version is with GPU & Cuda 10.2

Iodic answered 11/10, 2021 at 12:29 Comment(2)
Not sure if this is the case but the big size you see may not be caused by torch itself but rather by how docker works. See "Why are Docker container images so large?" (#24394743)Wolgast
Pytorch is still 887 MB - quite large.Rail
B
0

If you are not using gpu with your docker container, the cpu version will be much smaller since it does not contain all the overhead of CUDA. To have a cpu only version you can use :

RUN python3 -m pip install --no-cache-dir torch==1.9.1+cpu 

Also you can use wheel files (.whl) to install pytorch, this approach also can be viable if you want to trim some unnecessary components. You can find it on pytorch website:

Badillo answered 18/9 at 14:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.