VainF / Torch-Pruning

[CVPR 2023] Towards Any Structural Pruning; LLMs / SAM / Diffusion / Transformers / YOLOv8 / CNNs
https://arxiv.org/abs/2301.12900
MIT License
2.45k stars 309 forks source link

IndexError: index 512 is out of bounds for dimension 0 with size 512 #299

Open Minspeech opened 7 months ago

Minspeech commented 7 months ago

Thank you for your great work! I encountered the following problem when reproducing pruning. What happened?

Traceback (most recent call last): File "prune_hf_wav2vec.py", line 68, in for g in pruner.step(interactive=True): File "/root/anaconda3/envs/hugface2/lib/python3.8/site-packages/torch_pruning/pruner/algorithms/metapruner.py", line 347, in prune_local imp = self.estimate_importance(group, ch_groups=ch_groups) File "/root/anaconda3/envs/hugface2/lib/python3.8/site-packages/torch_pruning/pruner/algorithms/metapruner.py", line 234, in estimate_importance return self.importance(group, ch_groups=ch_groups) File "/root/anaconda3/envs/hugface2/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/root/anaconda3/envs/hugface2/lib/python3.8/site-packages/torch_pruning/pruner/importance.py", line 218, in call w = layer.weight.data[idxs] IndexError: index 512 is out of bounds for dimension 0 with size 512

644427434 commented 6 months ago

Hey! I had a similar problem, have you solved it ?