Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

fix IT pruning example issue #2772

Merged
merged 3 commits into from
Aug 11, 2020
Merged

fix IT pruning example issue #2772

merged 3 commits into from
Aug 11, 2020

Conversation

suiguoxin
Copy link
Member

Parameter 'optimizer ' was removed from Pruners ('level', 'slim', 'fpgm', 'l1', 'l2') in PR #2676. This example should be changed accordingly.

@@ -145,7 +145,10 @@ def create_model(model_name='naive'):
def create_pruner(model, pruner_name, optimizer=None):
pruner_class = prune_config[pruner_name]['pruner_class']
config_list = prune_config[pruner_name]['config_list']
return pruner_class(model, config_list, optimizer)
if pruner_name in ['level', 'slim', 'fpgm', 'l1filter']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why keep optimizer parameter for ActivationMeanRankFilterPruner and ActivationAPoZRankFilterPruner? they do not need optimizer hook either. For all one-shot pruners, it seems only TaylorFOWeightFilterPruner needs optimizer ( to calculate gradient contribution).

Copy link
Member Author

@suiguoxin suiguoxin Aug 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why keep optimizer parameter for ActivationMeanRankFilterPruner and ActivationAPoZRankFilterPruner? they do not need optimizer hook either. For all one-shot pruners, it seems only TaylorFOWeightFilterPruner needs optimizer ( to calculate gradient contribution).

In the current implementation, ActivationMeanRankFilterPruner and ActivationAPoZRankFilterPruner need the optimizer hook. If we remove the optimizer param, the sparsity after pruning will always be 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed in the meeting, let's not do this broken change?

@chicm-ms chicm-ms requested a review from QuanluZhang August 7, 2020 07:23
@chicm-ms chicm-ms merged commit d0a9b10 into microsoft:master Aug 11, 2020
LovPe pushed a commit to LovPe/nni that referenced this pull request Aug 17, 2020
@suiguoxin suiguoxin deleted the UT-fix branch August 20, 2020 08:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants