Torch-Pruning icon indicating copy to clipboard operation
Torch-Pruning copied to clipboard

Memory of Model Increases and Inference Stays the Same After Pruning

Open ydneysay opened this issue 5 years ago • 5 comments

The memory of my pytorch model increases after I save it to my directory using torch.save(). Also, the inference of my model does not really speed up. Shouldn't it decrease the memory and increase inference since it is structured pruning?

ydneysay avatar Mar 25 '21 04:03 ydneysay

Hi @ydneysay

Could you provide a minimal example to reproduce this issue?

VainF avatar Mar 25 '21 06:03 VainF

Hi,

I have a similar issue. I used the high level pruner "MagnitudePruner" for Mask-rcnn pruning, with iterative_steps = 1. The number of model paramers is reducec from 44M to 15.5M.

However, the inference after pruning is getting slower. image

Zhiwei-Zhai avatar Aug 14 '23 13:08 Zhiwei-Zhai

Hi,

I have a similar issue. I used the high level pruner "MagnitudePruner" for Mask-rcnn pruning, with iterative_steps = 1. The number of model paramers is reducec from 44M to 15.5M.

However, the inference after pruning is getting slower. image

Hi, Have you solved this problem? Now I have a similar problem. The inference time has not changed after pruning.

kewang-seu avatar Oct 14 '23 12:10 kewang-seu

Hello, if your model cannot fully utilize GPUs (less than 100%), width pruning may not lead to a significant acceleration of your model. In this case, increasing the batch size can show some improvements in speed.

VainF avatar Oct 16 '23 06:10 VainF

@ydneysay @Zhiwei-Zhai @kewang-seu Hi, have you solved the problem? In my case, the inference time increased after pruning.

J0eky avatar Dec 12 '23 07:12 J0eky