Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

剪枝时前面的层数正常,最后几层在对齐masks same size时报错 #18

Open
EricBlaine007 opened this issue May 10, 2023 · 0 comments

Comments

@EricBlaine007
Copy link

EricBlaine007 commented May 10, 2023

您好,我在剪枝自己写的模型时前面大部分层的剪枝都是正常的,但是最后某一层出现了如下问题:
Cutting layer is: self.channel_down.compactor
AAAAAAAAAAAAAA [32, 128, 1, 400] # 以下两行是我打印出来的 mask_dict[name], return_masks[name]
BBBBBBBBBBBBBB [400, 1, 128, 32]
Traceback (most recent call last):
File "/.../torch-model-compression-main/examples/torchslim/pytorch_cifar/prune.py", line 208, in
solver.run()
File "/.../torch-model-compression-main/torchslim/slim_solver.py", line 792, in run
self.run_hook(self.iteration_end_hook)
File "/.../torch-model-compression-main/torchslim/slim_solver.py", line 662, in run_hook
function(self)
File "/.../torch-model-compression-main/torchslim/pruning/resrep.py", line 838, in after_iteration_hook
self.config["min_channels"],
File "/.../torch-model-compression-main/torchslim/pruning/resrep.py", line 722, in prune_model
"conv.weight", index=min_index, dim=0
File "/.../torch-model-compression-main/torchpruner/graph.py", line 342, in cut_analysis
return current_module.terminal_node.cut_analysis(index, dim)
File "/.../torch-model-compression-main/torchpruner/graph.py", line 246, in cut_analysis
return self.cut_analysis_with_mask(mask)
File "/.../torch-model-compression-main/torchpruner/graph.py", line 292, in cut_analysis_with_mask
[mask_dict[name], return_masks[name]]
File "/.../torch-model-compression-main/torchpruner/mask_utils.py", line 70, in combine_mask
raise RuntimeError("The input mask size should be same")
RuntimeError: The input mask size should be same

Process finished with exit code 1
我屏蔽了一些name,发现该层中很多name都是报相同的错误,可以向您请教下该如何解决吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant