Torch-Pruning
Torch-Pruning copied to clipboard
IndexError: index 192 is out of bounds for dimension 0 with size 192
I am using this architecture (HR-Net) and below is my code snippet when I went to test prunning:
model = get_seg_model(train=True).eval()
imp = tp.importance.MagnitudeImportance() #whats this
example_inputs = torch.randn(1, 3, 512, 512)
pruner = tp.pruner.MetaPruner( # We can always choose MetaPruner if sparse training is not required.
model,
example_inputs,
importance=imp,
ch_sparsity=0.5, # remove 50% channels, ResNet18 = {64, 128, 256, 512} => ResNet18_Half = {32, 64, 128, 256}
# ch_sparsity_dict = {model.conv1: 0.2, model.layer2: 0.8}, # customized sparsity for layers or blocks
ignored_layers=None,
)
base_macs, base_nparams = tp.utils.count_ops_and_params(model, example_inputs)
pruner.step()
Then I get this error:
Any tips?
Hello, is the problem resolved?
I also encountered the same problem, have you solved it?
Hello, is the problem resolved?
I also encountered the same problem, have you solved it?
Nope, I didn't solve it.