Load the checkpoint saved from the previous fine-tuning stage. Increase the pruning ratio value to achieve higher levels of sparsity. With each pruning step, fine-tune this sparse model. Repeat this pruning and fine-tuning loop until the sparsity reaches the desired value or until it is observed that the evaluation performance degrades significantly.
model.load_weights("model_sparse_0.2") input_shape = [28, 28, 1] input_spec = tf.TensorSpec((1, *input_shape), tf.float32) runner = IterativePruningRunner(model, input_spec) sparse_model = runner.prune(ratio=0.5)