File tree Expand file tree Collapse file tree 2 files changed +32
-2
lines changed
Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ PaddleSlim推出全新自动压缩工具(ACT),旨在通过Source-Free的
99
1010## 环境准备
1111
12- - 安装PaddlePaddle >= 2.3版本 (从[ Paddle官网] ( https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html ) 下载安装)
12+ - 安装PaddlePaddle >= 2.2版本 (从[ Paddle官网] ( https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html ) 下载安装)
1313- 安装PaddleSlim >= 2.3 或者适当develop版本
1414
1515## 快速上手
Original file line number Diff line number Diff line change @@ -20,20 +20,50 @@ Quantization:
2020
2121#### 配置定制蒸馏策略
2222
23- 蒸馏参数主要设置蒸馏节点(` distill_node_pair`)和教师预测模型路径。蒸馏节点需包含教师网络节点和对应的学生网络节点,其中教师网络节点名称将在程序中自动添加 “teacher_” 前缀 ,如下所示:
23+ 蒸馏参数主要设置蒸馏节点(` distill_node_pair`)和教师预测模型路径,如下所示:
2424` ` ` yaml
2525Distillation:
26+ # distill_lambda: distill loss所占权重;可输入多个数值,支持不同节点之间使用不同的lambda值
2627 distill_lambda: 1.0
28+ # distill_loss: 蒸馏loss算法;可输入多个loss,支持不同节点之间使用不同的loss算法
2729 distill_loss: l2_loss
30+ # distill_node_pair: 蒸馏节点,即某层输出的变量名称,需包含教师网络节点和对应的学生网络节点,
31+ # 其中教师网络节点名称将在程序中自动添加 “teacher_” 前缀;
32+ # 可输入多个node_pair,支持多节点蒸馏
2833 distill_node_pair:
2934 - teacher_relu_30.tmp_0
3035 - relu_30.tmp_0
36+ # merge_feed: 若teacher和student的输入相同则为true,若teacher和student的输入不同则为false
3137 merge_feed: true
38+ # teacher_model_dir: 保存预测模型文件和预测模型参数文件的文件夹名称
3239 teacher_model_dir: ./inference_model
40+ # teacher_model_filename: 预测模型文件,格式为 *.pdmodel 或 __model__
3341 teacher_model_filename: model.pdmodel
42+ # teacher_params_filename: 预测模型参数文件,格式为 *.pdiparams 或 __params__
3443 teacher_params_filename: model.pdiparams
3544` ` `
3645
46+ - 蒸馏loss目前支持的有:fsp_loss,l2_loss,soft_label_loss,也可自定义loss。具体定义和使用可参考[知识蒸馏API文档](https://paddleslim.readthedocs.io/zh_CN/latest/api_cn/static/dist/single_distiller_api.html)。
47+
48+
49+ # ### 配置定制结构化稀疏策略
50+
51+ 结构化稀疏参数设置如下所示:
52+ ` ` ` yaml
53+ Prune:
54+ # prune_algo: 裁剪算法
55+ prune_algo: prune
56+ # pruned_ratio: 裁剪比例
57+ pruned_ratio: 0.25
58+ # prune_params_name: 需要裁剪的参数名字
59+ prune_params_name:
60+ - conv1_weights
61+ # criterion: 评估一个卷积层内通道重要性所参考的指标
62+ criterion: l1_norm
63+ ` ` `
64+ - prune_algo目前支持的有:prune、asp和transformer_pruner。
65+ - criterion目前支持的有:l1_norm , bn_scale , geometry_median。具体定义和使用可参考[结构化稀疏API文档](https://paddleslim.readthedocs.io/zh_CN/latest/api_cn/static/prune/prune_api.html)。
66+
3767# ### 配置定制非结构化稀疏策略
3868
3969非结构化稀疏参数设置如下所示,其中参数含义详见[非结构化稀疏API文档](https://github.com/PaddlePaddle/PaddleSlim/blob/develop/docs/zh_cn/api_cn/dygraph/pruners/unstructured_pruner.rst):
You can’t perform that action at this time.
0 commit comments