Open broken-dream opened 3 months ago
Hi! Please check this example: https://github.com/VainF/Torch-Pruning/blob/d7e23ed28dded2b6208074977f18b6302bb8a46e/examples/transformers/prune_hf_vit.py#L102 A num_heads parameter is required for transformer pruning.
I'm trying to prune a ViT model implemented in vit_pytorch but got following error:
This is a minimal example to reproduce the error:
From other similar issues, it seems this problem is caused by the
torch.split()
operation. But I didn't find any usage oftorch.split()
in vit_pytorch.I also tried to locate the problem by using
RandomImportance
mentioned in #147, but it works well when usingRandomImportance
.BTW, when I used
RandomImportance
to prune the model, I found that the parameter number of the model decreased but the inference time increased. I have no experience in model pruning so I have no idea if it's a normal phenomenon. But Intuitively fewer parameter should mean less time cost?