-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable BN adaptation upon compressed model initialization #41
Enable BN adaptation upon compressed model initialization #41
Conversation
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
@mkaglins have a look. This initialization procedure can be used for model subjected to filter pruning. We should try to reproduce the results of the FNNP paper saying that accuracy after BN adaptation correlates well with fine-tuned model accuracy (basically using Figure 4 of the paper as reference). |
Need to further rename QuantizationRangeInitArgs properly since it's now being used outside the quantization algo scope.
…ameter for algo initializers
@mkaglins could you also please run your fine-tuning experiments with L1/L2 and Geomean filter selection criteria separately? It'd be good to know whether the correlation between metrics depends somehow on the pruning criterion chosen. |
…um value. Appoximately same accuracy with fewer init steps required.
…anyalzr/nncf_pytorch into il/batch_statistics_adaptation
Jenkins please retry a build |
1 similar comment
Jenkins please retry a build |
@AlexKoff88 @vshampor PR is ready to be merged. BN adaptation is switched off by default for now. |
…olkit#41) * Add batchnorm statistics adaptation to quantization algo initializer * Enable BN stats adaptation for filter pruning. Need to further rename QuantizationRangeInitArgs properly since it's now being used outside the quantization algo scope. * + BN adaptation for magnitude sparsity * Extend the config schema to include the *num_bn_adaptation_steps* parameter for algo initializers * Proper pass of BN adaptation args (dataloader) via BNAdaptationInitArgs struct * Improved config setting for BN adaptation parameters * Remove initialzier in config schema for RB sparsity * Replace resetting of BN stats with a forgetting step via large momentum value. Appoximately same accuracy with fewer init steps required. * Fix forgetting momentum value * Default num of steps = 20 for BN adaptation since it is sufficient empirically * Move BN adaptation to base algo class * formatting * Fix export_model method docstring for filter pruning * Fix range init call counter test for BN adaptation * No BN adaptation by default, adjust call counter test * add BN adaptation docs
The PR adds a final BatchNorm statistics adaptation step to any compressed model initializer.
This is roughly based on the results of the FNNP paper and with further considerations that BN statistics adaptation acts as a bias & variance correction procedure following model weight perturbations during compression.
Preliminary results for quantization (ImageNet; fixed random seed for all expts; accuracy measured right after initialization):
NB: the "per-channel" tag above relates to weight quantization, activations are always quantized per-tensor. "(A)symmetric" relates to both weights and activations.
Pruning/sparsity results (ImageNet; fixed random seed for all expts; accuracy measured right after initialization)
Preliminary results obtained by fully resetting BN statistics after initialization and running inference of 200 batches (256 samples each).
To do's: