Skip to content
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

[Model Compression] Update api of iterative pruners #3507

Merged
merged 31 commits into from
May 25, 2021

Conversation

colorjam
Copy link
Contributor

@colorjam colorjam commented Apr 2, 2021

This pr reconstructs the category of pruners and improves the examples for model compression.

  • Separate iterative pruners from one-shot pruners. Add necessary parameters (trainer, training_epochs, criterion) to iterative pruners.
  • Modify StructuredFilterPruner -> DependencyAwarePruner.
  • Unify the models used in pruning and quantization, organize them into a folder.
  • Add one example (combined_compression.py) for end-to-end compression pipeline in 7 steps.
  • Update related docs.

@colorjam colorjam changed the title [Draft] Update model compression api [Model Compression] Update api of iterative pruners Apr 2, 2021
@ultmaster ultmaster linked an issue Apr 28, 2021 that may be closed by this pull request
@ultmaster ultmaster added this to In progress in v2.3 Apr 28, 2021
@ultmaster ultmaster moved this from In progress to Review in progress in v2.3 May 7, 2021
@@ -1,14 +1,13 @@
Supported Pruning Algorithms on NNI
===================================

We provide several pruning algorithms that support fine-grained weight pruning and structural filter pruning. **Fine-grained Pruning** generally results in unstructured models, which need specialized hardware or software to speed up the sparse network. **Filter Pruning** achieves acceleration by removing the entire filter. Some pruning algorithms use one-shot method that prune weights at once based on an importance metric. Other pruning algorithms control the **pruning schedule** that prune weights during optimization, including some automatic pruning algorithms.
We provide several pruning algorithms that support fine-grained weight pruning and structural filter pruning. **Fine-grained Pruning** generally results in unstructured models, which need specialized hardware or software to speed up the sparse network. **Filter Pruning** achieves acceleration by removing the entire filter. Some pruning algorithms use one-shot method that prune weights at once based on an importance metric (It is necessary to finetune the model to compensate for the loss of accuracy). Other pruning algorithms **iteratively** prune weights during optimization, which control the pruning schedule, including some automatic pruning algorithms.
Copy link
Contributor

Choose a reason for hiding this comment

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

Filter Pruning -> One-shot Pruning

Copy link
Contributor Author

@colorjam colorjam May 18, 2021

Choose a reason for hiding this comment

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

Filter Pruning and Fine-grained Pruning represent the alternative methods from the perspective of pruning granularity.

Copy link
Contributor

Choose a reason for hiding this comment

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

got it, so we have two categories, (Filter Pruning and Fine-grained Pruning), (Iteratively Pruning and One-shot Pruning)

Copy link
Contributor

Choose a reason for hiding this comment

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

what is the difference between "filter pruning" and "channel pruning"? "channel pruning" is also a type of "filter pruning"?

Copy link
Contributor

Choose a reason for hiding this comment

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

what is the difference between "filter pruning" and "channel pruning"? "channel pruning" is also a type of "filter pruning"?

Their selection rules are different, one is based on the weight of the filter(out-channel), the other is based on the weight of the input-channel. Filter pruning prunes the output channel of the conv layers and the channel pruning prunes the input channel of the conv layers. The have the same effect after the propagation( pruning an input channel is equivalent to pruning a filter of the previous conv) .

docs/zh_CN/Compression/CompressionReference.rst Outdated Show resolved Hide resolved
docs/zh_CN/Compression/CustomizeCompressor.rst Outdated Show resolved Hide resolved
@J-shang J-shang closed this May 24, 2021
v2.3 automation moved this from Review in progress to Done May 24, 2021
@J-shang J-shang reopened this May 24, 2021
v2.3 automation moved this from Done to In progress May 24, 2021
@J-shang J-shang closed this May 25, 2021
v2.3 automation moved this from In progress to Done May 25, 2021
@J-shang J-shang reopened this May 25, 2021
v2.3 automation moved this from Done to In progress May 25, 2021
v2.3 automation moved this from In progress to Reviewer approved May 25, 2021
@J-shang
Copy link
Contributor

J-shang commented May 25, 2021

Need follow-up:

  • check compression doc and update expired content.
  • TaylorFOWeightFilterPruner, ActivationAPoZRankFilterPruner, ActivationMeanRankFilterPruner check these pruners if need multi-epoch training.
  • SlimPruner check if we need support multi-iteration.
  • AutoCompressPruner ADMMPruner SimulatedAnnealingPruner check the relationship between these pruner.
  • test patch_optimizer_before() (callback)
  • AGP and ADMM may need to refactor compress().
  • Add full test

image

@J-shang J-shang merged commit 92f6754 into microsoft:master May 25, 2021
v2.3 automation moved this from Reviewer approved to Done May 25, 2021
ultmaster pushed a commit that referenced this pull request May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v2.3
Done
Development

Successfully merging this pull request may close these issues.

Model compression pipeline
6 participants