Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
5ce474bc
Unverified
Commit
5ce474bc
authored
Nov 26, 2021
by
Panacea
Committed by
GitHub
Nov 26, 2021
Browse files
[Model Compression] V2 doc translation (#4328)
parent
ef4459e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
7 deletions
+32
-7
docs/zh_CN/Compression/v2_pruning.rst
docs/zh_CN/Compression/v2_pruning.rst
+26
-0
docs/zh_CN/model_compression.rst
docs/zh_CN/model_compression.rst
+4
-3
nni/algorithms/compression/v2/pytorch/pruning/basic_pruner.py
...algorithms/compression/v2/pytorch/pruning/basic_pruner.py
+2
-4
No files found.
docs/zh_CN/Compression/v2_pruning.rst
0 → 100644
View file @
5ce474bc
#################
剪枝(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>
docs/zh_CN/model_compression.rst
View file @
5ce474bc
...
...
@@ -12,10 +12,10 @@
NNI 提供了易于使用的工具包来帮助用户设计并使用剪枝和量化算法。
其使用了统一的接口来支持 TensorFlow 和 PyTorch。
只需要添加几行代码即可压缩模型。
NNI 中也内置了一些流
程
的模型压缩算法。
对用户来说,
只需要添加几行代码即可压缩模型。
NNI 中也内置了一些
主
流的模型压缩算法。
用户可以进一步利用 NNI 的自动调优功能找到最佳的压缩模型,
自动模型压缩部分有详细介绍。
该功能在
自动模型压缩部分有详细介绍。
另一方面,用户可以使用 NNI 的接口自定义新的压缩算法。
详细信息,参考以下教程:
...
...
@@ -26,6 +26,7 @@ NNI 中也内置了一些流程的模型压缩算法。
概述 <Compression/Overview>
快速入门 <Compression/QuickStart>
剪枝 <Compression/pruning>
剪枝(V2版本) <Compression/v2_pruning>
量化 <Compression/quantization>
工具 <Compression/CompressionUtils>
高级用法 <Compression/advanced>
...
...
nni/algorithms/compression/v2/pytorch/pruning/basic_pruner.py
View file @
5ce474bc
...
...
@@ -347,8 +347,7 @@ class SlimPruner(BasicPruner):
Supported keys:
- sparsity : This is to specify the sparsity for each layer in this config to be compressed.
- sparsity_per_layer : Equals to sparsity.
- total_sparsity : This is to specify the total sparsity for all layers in this config,
each layer may have different sparsity.
- total_sparsity : This is to specify the total sparsity for all layers in this config, each layer may have different sparsity.
- 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_names : Operation names to prune.
...
...
@@ -562,8 +561,7 @@ class TaylorFOWeightPruner(BasicPruner):
Supported keys:
- sparsity : This is to specify the sparsity for each layer in this config to be compressed.
- sparsity_per_layer : Equals to sparsity.
- total_sparsity : This is to specify the total sparsity for all layers in this config,
each layer may have different sparsity.
- total_sparsity : This is to specify the total sparsity for all layers in this config, each layer may have different sparsity.
- 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_names : Operation names to prune.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment