Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pytorch package too huge

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

like image 584
Slavka Avatar asked Mar 01 '26 11:03

Slavka


1 Answers

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:

like image 152
NadTraps Avatar answered Mar 03 '26 03:03

NadTraps