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

[CVPR 2023] Towards Any Structural Pruning; LLMs / SAM / Diffusion / Transformers / YOLOv8 / CNNs

Results 196 Torch-Pruning issues
Sort by recently updated
recently updated
newest added

1. 你好,我在使用torch_pruner进行剪枝时,我在训练时使用了稀疏训练,想设置bn层的剪枝率根据bn的gamma来进行剪枝,我传入了root_module_types = [ops.TORCH_BATCHNORM]。 2. 我在尝试传入ch_sparsity_dict的时候,发现在target_sparsity = self.get_target_sparsity(module)这里,这个module是没有在self.ch_sparsity_dict.keys()里的,而我生成ch_sparsity_dict是使用的如下方式: ``` python for bnname, bnlayer in self.model.named_modules(): if isinstance(bnlayer, nn.BatchNorm2d): ch_sparsity_dict.update({bnlayer: ratio) ``` 这种方式生成的dict好像不大可行?还是我的使用方法不对呢?

userwarning:Unwrapped parameters detected:['fpn.p6_w1','fpn.p3_w1'......] KeyError: Parameter containing: tensor([1.,1.],requires_grad=True)

作者你好, 我正在理解你撰寫的code,其中有問題想詢問您, 大致上,實現流程是利用build_dependency建立依賴關係後, 再利用get_pruning_group(idx)得到需要pruning的group, 最後使用prune_out_channels和prune_in_channels進行pruning,是這樣嗎? 以及model是在哪裡被pruning進而更改原始架構的呢? 我想觀察model逐漸壓縮的過程,因此想知道是在哪個檔案實現的, 十分感謝!

Is there any tutorials? please

I'm trying to run this script https://github.com/VainF/Torch-Pruning/tree/master/examples/yolov8 on segmentation model (yolov8n-seg). I added this lines at the start of prune() ```python pruning_cfg['task'] = args.task = 'segment' batch_size = pruning_cfg['batch'] =...

ViT-S is not there in torchvision.models.vision_transformer , It is there in timm.models.vision_transformer . When I was trying to prune the vit_small_patch16_224 , I am getting error as local_norm = local_norm[idxs]...

Hi, @VainF Thanks for your great work first! It will always loss acc after we pruned a model under my understanding, so we need finetuning our model after pruning. So...

作者您好 @VainF,各位好,非常感谢您和您的团队在本工作中的巨大贡献! 本人是个深度学习的初学者,目前就搞一搞剪枝算法。在此有几个小问题想和您请教一下,您的一个小建议可能就会对我有很大的启发,望您能够不吝赐教: Q1:我是否能把depgraph(包括importance group)理解成一种剪枝的媒介:也就是无论什么剪枝方法(不管是用来修剪RNN的方法还是用来修剪CNN的方法)都可以通过这样的一个媒介去修剪任意的网络结构(RNN,CNN,TRANSFORMER.....)吗?如果我理解得不对烦请指正一下。 Q2:假设我自己设计了一种剪枝方法,我只对他在LSTM上面测试过,**现在我需要一些benchmarks去测试我剪枝方法的性能**。我是否可以借助torch_pruning去实现这个需求?我现在主要纠结的一点就是我的剪枝方法是针对LSTM设计的,就是对其权值矩阵进行规则化的稀疏。我始终不明白如何通过您的方法去把我的剪枝方法应用在不同的网络。 Q3:如果您的方法不能实现检验剪枝方法的benchmark,那么关于这个问题您是否能够给一些小建议。 非常感谢!期待您的答复!

Thank you for your amazing work! I have a question about sparsity. Even though I set sparsity as 0.1, which refers 10%, but I could check that 20% of the...

Thanks for the wonderful code! I wonder whether this code can be used to prune ViT models that are not generated by torchvision but by transformers package?

enhancement