Unverified Commit 5ce474bc authored by Panacea's avatar Panacea Committed by GitHub
Browse files

[Model Compression] V2 doc translation (#4328)

parent ef4459e4
#################
剪枝(V2版本)
#################
剪枝(V2版本)是对旧版本的重构,提供了更强大的功能。
与旧版本相比,迭代剪枝过程与剪枝器(pruner)分离,剪枝器只负责剪枝且生成掩码一次。
更重要的是,V2版本统一了剪枝过程,并提供了更自由的剪枝组件组合。
任务生成器(task generator)只关心在每一轮中应该达到的修剪效果,并使用配置列表(config list)来表示下一步如何修剪。
剪枝器将使用任务生成器提供的模型和配置列表重置,然后在当前步骤中生成掩码。
有关更清晰的架构,请参考下图。
.. image:: ../../img/pruning_process.png
:target: ../../img/pruning_process.png
:alt:
在V2版本中,修剪过程通常由剪枝调度器(pruning scheduler)驱动,它包含一个特定的剪枝器和一个任务生成器。
但是用户也可以像V1版本中那样直接使用剪枝器。
有关详细信息,请参阅以下教程:
.. toctree::
:maxdepth: 1
剪枝算法 <../en_US/Compression/v2_pruning_algo>
剪枝调度器接口 <../en_US/Compression/v2_scheduler>
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
NNI 提供了易于使用的工具包来帮助用户设计并使用剪枝和量化算法。 NNI 提供了易于使用的工具包来帮助用户设计并使用剪枝和量化算法。
其使用了统一的接口来支持 TensorFlow 和 PyTorch。 其使用了统一的接口来支持 TensorFlow 和 PyTorch。
只需要添加几行代码即可压缩模型。 对用户来说, 只需要添加几行代码即可压缩模型。
NNI 中也内置了一些流的模型压缩算法。 NNI 中也内置了一些流的模型压缩算法。
用户可以进一步利用 NNI 的自动调优功能找到最佳的压缩模型, 用户可以进一步利用 NNI 的自动调优功能找到最佳的压缩模型,
自动模型压缩部分有详细介绍。 该功能在自动模型压缩部分有详细介绍。
另一方面,用户可以使用 NNI 的接口自定义新的压缩算法。 另一方面,用户可以使用 NNI 的接口自定义新的压缩算法。
详细信息,参考以下教程: 详细信息,参考以下教程:
...@@ -26,6 +26,7 @@ NNI 中也内置了一些流程的模型压缩算法。 ...@@ -26,6 +26,7 @@ NNI 中也内置了一些流程的模型压缩算法。
概述 <Compression/Overview> 概述 <Compression/Overview>
快速入门 <Compression/QuickStart> 快速入门 <Compression/QuickStart>
剪枝 <Compression/pruning> 剪枝 <Compression/pruning>
剪枝(V2版本) <Compression/v2_pruning>
量化 <Compression/quantization> 量化 <Compression/quantization>
工具 <Compression/CompressionUtils> 工具 <Compression/CompressionUtils>
高级用法 <Compression/advanced> 高级用法 <Compression/advanced>
......
...@@ -347,8 +347,7 @@ class SlimPruner(BasicPruner): ...@@ -347,8 +347,7 @@ class SlimPruner(BasicPruner):
Supported keys: Supported keys:
- sparsity : This is to specify the sparsity for each layer in this config to be compressed. - sparsity : This is to specify the sparsity for each layer in this config to be compressed.
- sparsity_per_layer : Equals to sparsity. - sparsity_per_layer : Equals to sparsity.
- total_sparsity : This is to specify the total sparsity for all layers in this config, - total_sparsity : This is to specify the total sparsity for all layers in this config, each layer may have different sparsity.
each layer may have different sparsity.
- max_sparsity_per_layer : Always used with total_sparsity. Limit the max sparsity of each layer. - max_sparsity_per_layer : Always used with total_sparsity. Limit the max sparsity of each layer.
- op_types : Only BatchNorm2d is supported in SlimPruner. - op_types : Only BatchNorm2d is supported in SlimPruner.
- op_names : Operation names to prune. - op_names : Operation names to prune.
...@@ -562,8 +561,7 @@ class TaylorFOWeightPruner(BasicPruner): ...@@ -562,8 +561,7 @@ class TaylorFOWeightPruner(BasicPruner):
Supported keys: Supported keys:
- sparsity : This is to specify the sparsity for each layer in this config to be compressed. - sparsity : This is to specify the sparsity for each layer in this config to be compressed.
- sparsity_per_layer : Equals to sparsity. - sparsity_per_layer : Equals to sparsity.
- total_sparsity : This is to specify the total sparsity for all layers in this config, - total_sparsity : This is to specify the total sparsity for all layers in this config, each layer may have different sparsity.
each layer may have different sparsity.
- max_sparsity_per_layer : Always used with total_sparsity. Limit the max sparsity of each layer. - max_sparsity_per_layer : Always used with total_sparsity. Limit the max sparsity of each layer.
- op_types : Conv2d and Linear are supported in TaylorFOWeightPruner. - op_types : Conv2d and Linear are supported in TaylorFOWeightPruner.
- op_names : Operation names to prune. - op_names : Operation names to prune.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment