Open wuxiaolianggit opened 3 years ago
@wuxiaolianggit 你好 我在prune ratio太高時也會遇到一樣的問題。 請問你後來怎麼解決的?
I have the same problem. Has it been solved?
lower the threshold, for example 0.7 -> 0.5
Thank you.However, I found that this problem may be caused by the fact that the pre-training model was not generated after sparsity training during pruning.
大神您好,我在进行prune模型时,出现[59, 64, 'M', 128, 128, 'M', 256, 256, 256, 256, 'M', 470, 239, 59, 40, 'M', 0, 3, 54, 483],有一层卷积数量是0,然后就报错了,怎么解决呢?
[59, 64, 'M', 128, 128, 'M', 256, 256, 256, 256, 'M', 470, 239, 59, 40, 'M', 0, 3, 54, 483] Traceback (most recent call last): File "prune.py", line 111, in
newmodel = vgg(cfg=cfg)
File "/home/wxl/temp/pytorch-slimming/vgg.py", line 13, in init
self.feature = self.make_layers(cfg, True)
File "/home/wxl/temp/pytorch-slimming/vgg.py", line 30, in make_layers
conv2d = nn.Conv2d(in_channels, v, kernel_size=3, padding=1, bias=False)
File "/home/wxl/project/py36/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 330, in init
False, _pair(0), groups, bias, padding_mode)
File "/home/wxl/project/py36/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 46, in init
self.reset_parameters()
File "/home/wxl/project/py36/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 49, in reset_parameters
init.kaiminguniform(self.weight, a=math.sqrt(5))
File "/home/wxl/project/py36/lib/python3.6/site-packages/torch/nn/init.py", line 314, in kaiminguniform
fan = _calculate_correct_fan(tensor, mode)
File "/home/wxl/project/py36/lib/python3.6/site-packages/torch/nn/init.py", line 283, in _calculate_correct_fan
fan_in, fan_out = _calculate_fan_in_and_fan_out(tensor)
File "/home/wxl/project/py36/lib/python3.6/site-packages/torch/nn/init.py", line 215, in _calculate_fan_in_and_fan_out
receptive_field_size = tensor[0][0].numel()
IndexError: index 0 is out of bounds for dimension 0 with size 0
@ @ @foolwood