Iterative Pruning - 1.4.1 English

Vitis AI Optimizer User Guide (UG1333)

Document ID
UG1333
Release Date
2021-10-29
Version
1.4.1 English

Load the sparse checkpoint and increase pruning ratio. Here, the pruning ratio is increased from 0.1 to 0.2.

model = resnet18()
model.load_state_dict(torch.load('resnet18_sparse.pth.tar'))

inputs = torch.randn([1, 3, 224, 224], dtype=torch.float32)
pruner = Pruner(model, inputs)
model = pruner.prune(ratio=0.2, output_script='pruned_resnet18.py')

Once the new pruned model is generated, you can start fine-tuning again.