Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
c90ab602
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
大约 2 年 前同步成功
通知
51
Star
1434
Fork
344
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
16
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSlim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
16
合并请求
16
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c90ab602
编写于
11月 23, 2022
作者:
Z
zhouzj
提交者:
GitHub
11月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ACT] Rename 'Quantization' to 'QuantAware'. (#1536)
* [ACT] Rename 'Quantization' to 'QuantAware'. * Fix examples. * Fix tests.
上级
dfe5bb3e
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
54 addition
and
53 deletion
+54
-53
example/auto_compression/README.md
example/auto_compression/README.md
+1
-1
example/auto_compression/detection/configs/picodet_s_qat_dis.yaml
...auto_compression/detection/configs/picodet_s_qat_dis.yaml
+1
-1
example/auto_compression/detection/configs/ppyoloe_l_qat_dis.yaml
...auto_compression/detection/configs/ppyoloe_l_qat_dis.yaml
+1
-1
example/auto_compression/detection/configs/ppyoloe_s_qat_dis.yaml
...auto_compression/detection/configs/ppyoloe_s_qat_dis.yaml
+1
-1
example/auto_compression/detection/configs/ssd_mbv1_voc_qat_dis.yaml
...o_compression/detection/configs/ssd_mbv1_voc_qat_dis.yaml
+1
-1
example/auto_compression/detection/configs/tinypose_qat_dis.yaml
.../auto_compression/detection/configs/tinypose_qat_dis.yaml
+1
-1
example/auto_compression/detection/configs/yolov3_mbv1_qat_dis.yaml
...to_compression/detection/configs/yolov3_mbv1_qat_dis.yaml
+1
-1
example/auto_compression/hyperparameter_tutorial.md
example/auto_compression/hyperparameter_tutorial.md
+2
-2
example/auto_compression/image_classification/configs/EfficientNetB0/qat_dis.yaml
.../image_classification/configs/EfficientNetB0/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/GhostNet_x1_0/qat_dis.yaml
...n/image_classification/configs/GhostNet_x1_0/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/InceptionV3/qat_dis.yaml
...ion/image_classification/configs/InceptionV3/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/MobileNetV1/qat_dis.yaml
...ion/image_classification/configs/MobileNetV1/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0/qat_dis.yaml
...lassification/configs/MobileNetV3_large_x1_0/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/PPHGNet_tiny/qat_dis.yaml
...on/image_classification/configs/PPHGNet_tiny/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/PPLCNetV2_base/qat_dis.yaml
.../image_classification/configs/PPLCNetV2_base/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/PPLCNet_x1_0/qat_dis.yaml
...on/image_classification/configs/PPLCNet_x1_0/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/ResNet50_vd/qat_dis.yaml
...ion/image_classification/configs/ResNet50_vd/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/ShuffleNetV2_x1_0/qat_dis.yaml
...age_classification/configs/ShuffleNetV2_x1_0/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/SqueezeNet1_0/qat_dis.yaml
...n/image_classification/configs/SqueezeNet1_0/qat_dis.yaml
+1
-1
example/auto_compression/image_classification/configs/SwinTransformer_base_patch4_window7_224/qat_dis.yaml
...figs/SwinTransformer_base_patch4_window7_224/qat_dis.yaml
+1
-1
example/auto_compression/ocr/configs/ppocrv3_det_qat_dist.yaml
...le/auto_compression/ocr/configs/ppocrv3_det_qat_dist.yaml
+1
-1
example/auto_compression/pytorch_yolo_series/configs/yolov5s_qat_dis.yaml
...pression/pytorch_yolo_series/configs/yolov5s_qat_dis.yaml
+1
-1
example/auto_compression/pytorch_yolo_series/configs/yolov6s_qat_dis.yaml
...pression/pytorch_yolo_series/configs/yolov6s_qat_dis.yaml
+1
-1
example/auto_compression/pytorch_yolo_series/configs/yolov6s_v2_qat_dis.yaml
...ssion/pytorch_yolo_series/configs/yolov6s_v2_qat_dis.yaml
+1
-1
example/auto_compression/pytorch_yolo_series/configs/yolov7_qat_dis.yaml
...mpression/pytorch_yolo_series/configs/yolov7_qat_dis.yaml
+1
-1
example/auto_compression/pytorch_yolo_series/configs/yolov7_tiny_qat_dis.yaml
...sion/pytorch_yolo_series/configs/yolov7_tiny_qat_dis.yaml
+1
-1
example/auto_compression/semantic_segmentation/configs/BiSeNetV2/BiSeNetV2_qat.yaml
...emantic_segmentation/configs/BiSeNetV2/BiSeNetV2_qat.yaml
+1
-1
example/auto_compression/semantic_segmentation/configs/deeplabv3/deeplabv3_qat.yaml
...emantic_segmentation/configs/deeplabv3/deeplabv3_qat.yaml
+1
-1
example/auto_compression/semantic_segmentation/configs/hrnet/hrnet_qat.yaml
...ession/semantic_segmentation/configs/hrnet/hrnet_qat.yaml
+1
-1
example/auto_compression/semantic_segmentation/configs/pp_humanseg/pp_humanseg_qat.yaml
...tic_segmentation/configs/pp_humanseg/pp_humanseg_qat.yaml
+1
-1
example/auto_compression/semantic_segmentation/configs/pp_liteseg/pp_liteseg_qat.yaml
...antic_segmentation/configs/pp_liteseg/pp_liteseg_qat.yaml
+1
-1
example/auto_compression/semantic_segmentation/configs/unet/unet_qat.yaml
...pression/semantic_segmentation/configs/unet/unet_qat.yaml
+1
-1
example/auto_compression/tensorflow_mobilenet/configs/mbv1_qat_dis.yaml
...ompression/tensorflow_mobilenet/configs/mbv1_qat_dis.yaml
+1
-1
example/full_quantization/image_classification/configs/mobilenetv3_large_qat_dis.yaml
...age_classification/configs/mobilenetv3_large_qat_dis.yaml
+1
-1
example/full_quantization/picodet/configs/picodet_npu.yaml
example/full_quantization/picodet/configs/picodet_npu.yaml
+1
-1
example/full_quantization/picodet/configs/picodet_npu_with_postprocess.yaml
...ization/picodet/configs/picodet_npu_with_postprocess.yaml
+1
-1
example/full_quantization/ppyoloe/configs/ppyoloe_s_416_qat_dis.yaml
...l_quantization/ppyoloe/configs/ppyoloe_s_416_qat_dis.yaml
+1
-1
example/full_quantization/ppyoloe/configs/ppyoloe_s_qat_dis.yaml
.../full_quantization/ppyoloe/configs/ppyoloe_s_qat_dis.yaml
+1
-1
paddleslim/auto_compression/__init__.py
paddleslim/auto_compression/__init__.py
+2
-1
paddleslim/auto_compression/auto_strategy.py
paddleslim/auto_compression/auto_strategy.py
+6
-6
paddleslim/auto_compression/compressor.py
paddleslim/auto_compression/compressor.py
+2
-2
paddleslim/auto_compression/strategy_config.py
paddleslim/auto_compression/strategy_config.py
+4
-4
tests/act/qat_dist_train.yaml
tests/act/qat_dist_train.yaml
+1
-1
未找到文件。
example/auto_compression/README.md
浏览文件 @
c90ab602
...
@@ -178,7 +178,7 @@ ac = AutoCompression(
...
@@ -178,7 +178,7 @@ ac = AutoCompression(
params_filename
=
"inference.pdiparams"
,
params_filename
=
"inference.pdiparams"
,
save_dir
=
"MobileNetV1_quant"
,
save_dir
=
"MobileNetV1_quant"
,
config
=
{
"QuantPost"
:
{},
"HyperParameterOptimization"
:
{
'ptq_algo'
:
[
'avg'
],
'max_quant_count'
:
3
}},
config
=
{
"QuantPost"
:
{},
"HyperParameterOptimization"
:
{
'ptq_algo'
:
[
'avg'
],
'max_quant_count'
:
3
}},
### config={"Quant
ization
": {}, "Distillation": {}}, ### 如果您的系统为Windows系统, 请使用当前这一行配置
### config={"Quant
Aware
": {}, "Distillation": {}}, ### 如果您的系统为Windows系统, 请使用当前这一行配置
train_dataloader
=
train_loader
,
train_dataloader
=
train_loader
,
eval_dataloader
=
train_loader
)
eval_dataloader
=
train_loader
)
ac
.
compress
()
ac
.
compress
()
...
...
example/auto_compression/detection/configs/picodet_s_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -18,7 +18,7 @@ Distillation:
...
@@ -18,7 +18,7 @@ Distillation:
-
conv2d_154.tmp_1
-
conv2d_154.tmp_1
-
tmp_8
-
tmp_8
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
weight_bits
:
8
weight_bits
:
8
...
...
example/auto_compression/detection/configs/ppyoloe_l_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -11,7 +11,7 @@ Distillation:
...
@@ -11,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
onnx_format
:
true
onnx_format
:
true
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
...
...
example/auto_compression/detection/configs/ppyoloe_s_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -11,7 +11,7 @@ Distillation:
...
@@ -11,7 +11,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
onnx_format
:
true
onnx_format
:
true
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
...
...
example/auto_compression/detection/configs/ssd_mbv1_voc_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -13,7 +13,7 @@ Distillation:
...
@@ -13,7 +13,7 @@ Distillation:
-
concat_2.tmp_0
-
concat_2.tmp_0
-
concat_1.tmp_0
-
concat_1.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
True
use_pact
:
True
weight_quantize_type
:
'
channel_wise_abs_max'
weight_quantize_type
:
'
channel_wise_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
...
...
example/auto_compression/detection/configs/tinypose_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -12,7 +12,7 @@ Distillation:
...
@@ -12,7 +12,7 @@ Distillation:
node
:
node
:
-
conv2d_441.tmp_0
-
conv2d_441.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
weight_quantize_type
:
'
channel_wise_abs_max'
# 'abs_max' is layer wise quant
weight_quantize_type
:
'
channel_wise_abs_max'
# 'abs_max' is layer wise quant
...
...
example/auto_compression/detection/configs/yolov3_mbv1_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -13,7 +13,7 @@ Distillation:
...
@@ -13,7 +13,7 @@ Distillation:
-
conv2d_85.tmp_0
-
conv2d_85.tmp_0
-
conv2d_86.tmp_0
-
conv2d_86.tmp_0
Quant
ization
:
Quant
Aware
:
activation_quantize_type
:
'
range_abs_max'
activation_quantize_type
:
'
range_abs_max'
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
...
...
example/auto_compression/hyperparameter_tutorial.md
浏览文件 @
c90ab602
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
## 1.1 各压缩方法超参解析
## 1.1 各压缩方法超参解析
### 1.1.1 量化训练(quant
ization
)
### 1.1.1 量化训练(quant
aware
)
量化参数主要设置量化比特数和量化op类型,其中量化op包含卷积层(conv2d, depthwise_conv2d)和全连接层(mul, matmul_v2)。以下为只量化卷积层的示例:
量化参数主要设置量化比特数和量化op类型,其中量化op包含卷积层(conv2d, depthwise_conv2d)和全连接层(mul, matmul_v2)。以下为只量化卷积层的示例:
```
yaml
```
yaml
Quant
ization
:
Quant
Aware
:
use_pact
:
false
# 量化训练是否使用PACT方法
use_pact
:
false
# 量化训练是否使用PACT方法
weight_quantize_type
:
'
channel_wise_abs_max'
# 权重量化方式
weight_quantize_type
:
'
channel_wise_abs_max'
# 权重量化方式
quantize_op_types
:
[
conv2d
,
depthwise_conv2d
]
# 量化OP列表
quantize_op_types
:
[
conv2d
,
depthwise_conv2d
]
# 量化OP列表
...
...
example/auto_compression/image_classification/configs/EfficientNetB0/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -11,7 +11,7 @@ Distillation:
...
@@ -11,7 +11,7 @@ Distillation:
node
:
node
:
-
softmax_1.tmp_0
-
softmax_1.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/image_classification/configs/GhostNet_x1_0/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
loss
:
l2
loss
:
l2
node
:
node
:
-
softmax_0.tmp_0
-
softmax_0.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/image_classification/configs/InceptionV3/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -12,7 +12,7 @@ Distillation:
...
@@ -12,7 +12,7 @@ Distillation:
loss
:
l2
loss
:
l2
node
:
node
:
-
softmax_1.tmp_0
-
softmax_1.tmp_0
Quant
ization
:
Quant
Aware
:
is_full_quantize
:
false
is_full_quantize
:
false
activation_quantize_type
:
moving_average_abs_max
activation_quantize_type
:
moving_average_abs_max
weight_quantize_type
:
channel_wise_abs_max
weight_quantize_type
:
channel_wise_abs_max
...
...
example/auto_compression/image_classification/configs/MobileNetV1/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
loss
:
l2
loss
:
l2
node
:
node
:
-
softmax_0.tmp_0
-
softmax_0.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -9,7 +9,7 @@ Distillation:
...
@@ -9,7 +9,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/image_classification/configs/PPHGNet_tiny/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -11,7 +11,7 @@ Distillation:
...
@@ -11,7 +11,7 @@ Distillation:
node
:
node
:
-
softmax_1.tmp_0
-
softmax_1.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/image_classification/configs/PPLCNetV2_base/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -11,7 +11,7 @@ Distillation:
...
@@ -11,7 +11,7 @@ Distillation:
node
:
node
:
-
softmax_1.tmp_0
-
softmax_1.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/image_classification/configs/PPLCNet_x1_0/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
loss
:
l2
loss
:
l2
node
:
node
:
-
softmax_1.tmp_0
-
softmax_1.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/image_classification/configs/ResNet50_vd/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -11,7 +11,7 @@ Distillation:
...
@@ -11,7 +11,7 @@ Distillation:
node
:
node
:
-
softmax_0.tmp_0
-
softmax_0.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/image_classification/configs/ShuffleNetV2_x1_0/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
loss
:
l2
loss
:
l2
node
:
node
:
-
softmax_0.tmp_0
-
softmax_0.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/image_classification/configs/SqueezeNet1_0/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
loss
:
l2
loss
:
l2
node
:
node
:
-
softmax_0.tmp_0
-
softmax_0.tmp_0
Quant
ization
:
Quant
Aware
:
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
activation_quantize_type
:
moving_average_abs_max
activation_quantize_type
:
moving_average_abs_max
...
...
example/auto_compression/image_classification/configs/SwinTransformer_base_patch4_window7_224/qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
loss
:
l2
loss
:
l2
node
:
node
:
-
softmax_48.tmp_0
-
softmax_48.tmp_0
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/ocr/configs/ppocrv3_det_qat_dist.yaml
浏览文件 @
c90ab602
...
@@ -9,7 +9,7 @@ Distillation:
...
@@ -9,7 +9,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
l2
loss
:
l2
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/auto_compression/pytorch_yolo_series/configs/yolov5s_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -12,7 +12,7 @@ Distillation:
...
@@ -12,7 +12,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
onnx_format
:
true
onnx_format
:
true
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
...
...
example/auto_compression/pytorch_yolo_series/configs/yolov6s_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -12,7 +12,7 @@ Distillation:
...
@@ -12,7 +12,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
onnx_format
:
true
onnx_format
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
example/auto_compression/pytorch_yolo_series/configs/yolov6s_v2_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -13,7 +13,7 @@ Distillation:
...
@@ -13,7 +13,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
onnx_format
:
true
onnx_format
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
example/auto_compression/pytorch_yolo_series/configs/yolov7_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -12,7 +12,7 @@ Distillation:
...
@@ -12,7 +12,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
onnx_format
:
true
onnx_format
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
example/auto_compression/pytorch_yolo_series/configs/yolov7_tiny_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -12,7 +12,7 @@ Distillation:
...
@@ -12,7 +12,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
onnx_format
:
true
onnx_format
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
quantize_op_types
:
quantize_op_types
:
...
...
example/auto_compression/semantic_segmentation/configs/BiSeNetV2/BiSeNetV2_qat.yaml
浏览文件 @
c90ab602
...
@@ -11,7 +11,7 @@ Distillation:
...
@@ -11,7 +11,7 @@ Distillation:
node
:
node
:
-
conv2d_103.tmp_1
-
conv2d_103.tmp_1
Quant
ization
:
Quant
Aware
:
onnx_format
:
True
onnx_format
:
True
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
...
...
example/auto_compression/semantic_segmentation/configs/deeplabv3/deeplabv3_qat.yaml
浏览文件 @
c90ab602
...
@@ -11,7 +11,7 @@ Distillation:
...
@@ -11,7 +11,7 @@ Distillation:
node
:
node
:
-
conv2d_123.tmp_1
-
conv2d_123.tmp_1
Quant
ization
:
Quant
Aware
:
onnx_format
:
True
onnx_format
:
True
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
...
...
example/auto_compression/semantic_segmentation/configs/hrnet/hrnet_qat.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
node
:
node
:
-
conv2d_613.tmp_1
-
conv2d_613.tmp_1
Quant
ization
:
Quant
Aware
:
onnx_format
:
True
onnx_format
:
True
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
...
...
example/auto_compression/semantic_segmentation/configs/pp_humanseg/pp_humanseg_qat.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
node
:
node
:
-
batch_norm_47.tmp_2
-
batch_norm_47.tmp_2
Quant
ization
:
Quant
Aware
:
onnx_format
:
True
onnx_format
:
True
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
...
...
example/auto_compression/semantic_segmentation/configs/pp_liteseg/pp_liteseg_qat.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
node
:
node
:
-
conv2d_95.tmp_0
-
conv2d_95.tmp_0
Quant
ization
:
Quant
Aware
:
onnx_format
:
True
onnx_format
:
True
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
...
...
example/auto_compression/semantic_segmentation/configs/unet/unet_qat.yaml
浏览文件 @
c90ab602
...
@@ -10,7 +10,7 @@ Distillation:
...
@@ -10,7 +10,7 @@ Distillation:
node
:
node
:
-
conv2d_37.tmp_1
-
conv2d_37.tmp_1
Quant
ization
:
Quant
Aware
:
onnx_format
:
True
onnx_format
:
True
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
...
...
example/auto_compression/tensorflow_mobilenet/configs/mbv1_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -38,7 +38,7 @@ Distillation:
...
@@ -38,7 +38,7 @@ Distillation:
-
batch_norm_26.tmp_3
-
batch_norm_26.tmp_3
-
conv2d_42.tmp_1
-
conv2d_42.tmp_1
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
is_full_quantize
:
false
is_full_quantize
:
false
...
...
example/full_quantization/image_classification/configs/mobilenetv3_large_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -9,7 +9,7 @@ Global:
...
@@ -9,7 +9,7 @@ Global:
Distillation
:
Distillation
:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
Quant
Aware
:
use_pact
:
true
use_pact
:
true
activation_bits
:
8
activation_bits
:
8
activation_quantize_type
:
moving_average_abs_max
activation_quantize_type
:
moving_average_abs_max
...
...
example/full_quantization/picodet/configs/picodet_npu.yaml
浏览文件 @
c90ab602
...
@@ -15,7 +15,7 @@ PTQ: # Post Training Quantization
...
@@ -15,7 +15,7 @@ PTQ: # Post Training Quantization
batch_size
:
32
batch_size
:
32
batch_nums
:
10
batch_nums
:
10
Quant
ization
:
# Auto Compression
Quant
Aware
:
# Auto Compression
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
weight_bits
:
8
weight_bits
:
8
...
...
example/full_quantization/picodet/configs/picodet_npu_with_postprocess.yaml
浏览文件 @
c90ab602
...
@@ -15,7 +15,7 @@ PTQ: # Post Training Quantization
...
@@ -15,7 +15,7 @@ PTQ: # Post Training Quantization
batch_size
:
32
batch_size
:
32
batch_nums
:
10
batch_nums
:
10
Quant
ization
:
# Auto Compression
Quant
Aware
:
# Auto Compression
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
weight_bits
:
8
weight_bits
:
8
...
...
example/full_quantization/ppyoloe/configs/ppyoloe_s_416_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -20,7 +20,7 @@ Distillation:
...
@@ -20,7 +20,7 @@ Distillation:
alpha
:
1.0
alpha
:
1.0
loss
:
soft_label
loss
:
soft_label
Quant
ization
:
# Auto Compression
Quant
Aware
:
# Auto Compression
onnx_format
:
true
onnx_format
:
true
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
...
...
example/full_quantization/ppyoloe/configs/ppyoloe_s_qat_dis.yaml
浏览文件 @
c90ab602
...
@@ -16,7 +16,7 @@ PTQ: # Post Training Quantization
...
@@ -16,7 +16,7 @@ PTQ: # Post Training Quantization
batch_size
:
10
batch_size
:
10
batch_nums
:
10
batch_nums
:
10
Quant
ization
:
# Auto Compression
Quant
Aware
:
# Auto Compression
onnx_format
:
true
onnx_format
:
true
use_pact
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
activation_quantize_type
:
'
moving_average_abs_max'
...
...
paddleslim/auto_compression/__init__.py
浏览文件 @
c90ab602
...
@@ -20,7 +20,8 @@ from .utils import *
...
@@ -20,7 +20,8 @@ from .utils import *
__all__
=
[
__all__
=
[
"AutoCompression"
,
"AutoCompression"
,
"Quantization"
,
"QuantAware"
,
"QuantPost"
,
"Distillation"
,
"Distillation"
,
"MultiTeacherDistillation"
,
"MultiTeacherDistillation"
,
"HyperParameterOptimization"
,
"HyperParameterOptimization"
,
...
...
paddleslim/auto_compression/auto_strategy.py
浏览文件 @
c90ab602
...
@@ -125,17 +125,17 @@ def create_strategy_config(strategy_str, model_type):
...
@@ -125,17 +125,17 @@ def create_strategy_config(strategy_str, model_type):
### only platform is linux can use smac to do hyperparameter optimization
### only platform is linux can use smac to do hyperparameter optimization
### choose quant_aware to do quantization in other platform
### choose quant_aware to do quantization in other platform
if
platform
.
system
().
lower
()
==
'linux'
:
if
platform
.
system
().
lower
()
==
'linux'
:
quant_config
=
Quant
ization
(
**
default_quant_config
)
quant_config
=
Quant
Aware
(
**
default_quant_config
)
hpo_config
=
HyperParameterOptimization
(
**
hpo_config_tester
)
hpo_config
=
HyperParameterOptimization
(
**
hpo_config_tester
)
configs
.
append
({
configs
.
append
({
'QuantPost'
:
quant_config
,
'QuantPost'
:
quant_config
,
'HyperParameterOptimization'
:
hpo_config
'HyperParameterOptimization'
:
hpo_config
})
})
else
:
else
:
quant_config
=
Quant
ization
(
**
default_quant_config
)
quant_config
=
Quant
Aware
(
**
default_quant_config
)
dis_config
=
Distillation
()
dis_config
=
Distillation
()
configs
.
append
({
configs
.
append
({
'Quant
ization
'
:
quant_config
,
'Quant
Aware
'
:
quant_config
,
'Distillation'
:
dis_config
'Distillation'
:
dis_config
})
})
...
@@ -248,7 +248,7 @@ def get_final_quant_config(ptq_loss, model_type=None):
...
@@ -248,7 +248,7 @@ def get_final_quant_config(ptq_loss, model_type=None):
return
None
return
None
### if emd loss less than MAGIC_MAX_EMD_DISTANCE, select quant_post & hpo.
### if emd loss less than MAGIC_MAX_EMD_DISTANCE, select quant_post & hpo.
elif
ptq_loss
<
MAGIC_MAX_EMD_DISTANCE
:
elif
ptq_loss
<
MAGIC_MAX_EMD_DISTANCE
:
quant_config
=
Quant
ization
(
**
default_quant_config
)
quant_config
=
Quant
Aware
(
**
default_quant_config
)
hpo_config
=
HyperParameterOptimization
(
**
default_hpo_config
)
hpo_config
=
HyperParameterOptimization
(
**
default_hpo_config
)
configs
=
[{
configs
=
[{
'QuantPost'
:
quant_config
,
'QuantPost'
:
quant_config
,
...
@@ -257,9 +257,9 @@ def get_final_quant_config(ptq_loss, model_type=None):
...
@@ -257,9 +257,9 @@ def get_final_quant_config(ptq_loss, model_type=None):
### if emd loss greater than MAGIC_MAX_EMD_DISTANCE, select qat & dist.
### if emd loss greater than MAGIC_MAX_EMD_DISTANCE, select qat & dist.
else
:
else
:
quant_config
=
Quant
ization
(
**
default_quant_config
)
quant_config
=
Quant
Aware
(
**
default_quant_config
)
dis_config
=
Distillation
()
dis_config
=
Distillation
()
configs
=
[{
'Quant
ization
'
:
quant_config
,
'Distillation'
:
dis_config
}]
configs
=
[{
'Quant
Aware
'
:
quant_config
,
'Distillation'
:
dis_config
}]
_logger
.
info
(
"Start Quantization and Distillation Training."
)
_logger
.
info
(
"Start Quantization and Distillation Training."
)
return
configs
return
configs
...
...
paddleslim/auto_compression/compressor.py
浏览文件 @
c90ab602
...
@@ -88,7 +88,7 @@ class AutoCompression:
...
@@ -88,7 +88,7 @@ class AutoCompression:
Only one strategy(quant_post with hyperparameter optimization) can set train_config
Only one strategy(quant_post with hyperparameter optimization) can set train_config
to None. Default: None.
to None. Default: None.
strategy_config(dict, list(dict), optional): The strategy config. You can set single config to get multi-strategy config, such as
strategy_config(dict, list(dict), optional): The strategy config. You can set single config to get multi-strategy config, such as
1. set ``Quant
ization
`` and ``Distillation`` to get quant_aware and distillation compress config.
1. set ``Quant
Aware
`` and ``Distillation`` to get quant_aware and distillation compress config.
The Quantization config can reference `https://github.com/PaddlePaddle/PaddleSlim/blob/develop/paddleslim/auto_compression/strategy_config.py#L55`_ .
The Quantization config can reference `https://github.com/PaddlePaddle/PaddleSlim/blob/develop/paddleslim/auto_compression/strategy_config.py#L55`_ .
The Distillation config can reference `https://github.com/PaddlePaddle/PaddleSlim/blob/develop/paddleslim/auto_compression/strategy_config.py#L107`_ .
The Distillation config can reference `https://github.com/PaddlePaddle/PaddleSlim/blob/develop/paddleslim/auto_compression/strategy_config.py#L107`_ .
2. set ``QuantPost`` and ``HyperParameterOptimization`` to get quant_post and hyperparameter optimization compress config.
2. set ``QuantPost`` and ``HyperParameterOptimization`` to get quant_post and hyperparameter optimization compress config.
...
@@ -350,7 +350,7 @@ class AutoCompression:
...
@@ -350,7 +350,7 @@ class AutoCompression:
strategy
=
[]
strategy
=
[]
config
=
[]
config
=
[]
for
strategy_c
in
strategy_config
:
for
strategy_c
in
strategy_config
:
quant_config
=
strategy_c
.
get
(
"Quant
ization
"
,
None
)
quant_config
=
strategy_c
.
get
(
"Quant
Aware
"
,
None
)
hpo_config
=
strategy_c
.
get
(
"HyperParameterOptimization"
,
None
)
hpo_config
=
strategy_c
.
get
(
"HyperParameterOptimization"
,
None
)
ptq_config
=
strategy_c
.
get
(
"QuantPost"
,
None
)
ptq_config
=
strategy_c
.
get
(
"QuantPost"
,
None
)
prune_config
=
strategy_c
.
get
(
"ChannelPrune"
,
None
)
prune_config
=
strategy_c
.
get
(
"ChannelPrune"
,
None
)
...
...
paddleslim/auto_compression/strategy_config.py
浏览文件 @
c90ab602
...
@@ -16,7 +16,7 @@ from collections import namedtuple
...
@@ -16,7 +16,7 @@ from collections import namedtuple
__all__
=
[
__all__
=
[
"BaseStrategy"
,
"BaseStrategy"
,
"Quant
ization
"
,
"Quant
Aware
"
,
"Distillation"
,
"Distillation"
,
"MultiTeacherDistillation"
,
"MultiTeacherDistillation"
,
"HyperParameterOptimization"
,
"HyperParameterOptimization"
,
...
@@ -33,7 +33,7 @@ __all__ = [
...
@@ -33,7 +33,7 @@ __all__ = [
]
]
SUPPORTED_CONFIG
=
[
SUPPORTED_CONFIG
=
[
"Quant
ization
"
,
"Quant
Aware
"
,
"Distillation"
,
"Distillation"
,
"MultiTeacherDistillation"
,
"MultiTeacherDistillation"
,
"HyperParameterOptimization"
,
"HyperParameterOptimization"
,
...
@@ -52,7 +52,7 @@ class BaseStrategy:
...
@@ -52,7 +52,7 @@ class BaseStrategy:
self
.
name
=
name
self
.
name
=
name
class
Quant
ization
(
BaseStrategy
):
class
Quant
Aware
(
BaseStrategy
):
def
__init__
(
self
,
def
__init__
(
self
,
quantize_op_types
=
[
quantize_op_types
=
[
'conv2d'
,
'depthwise_conv2d'
,
'conv2d_transpose'
,
'mul'
,
'conv2d'
,
'depthwise_conv2d'
,
'conv2d_transpose'
,
'mul'
,
...
@@ -87,7 +87,7 @@ class Quantization(BaseStrategy):
...
@@ -87,7 +87,7 @@ class Quantization(BaseStrategy):
onnx_format(bool): Whether to export the quantized model with format of ONNX. Default is False.
onnx_format(bool): Whether to export the quantized model with format of ONNX. Default is False.
is_full_quantize(bool): If True, 'quantoze_op_types' will be TRANSFORM_PASS_OP_TYPES + QUANT_DEQUANT_PASS_OP_TYPES. Default: False.
is_full_quantize(bool): If True, 'quantoze_op_types' will be TRANSFORM_PASS_OP_TYPES + QUANT_DEQUANT_PASS_OP_TYPES. Default: False.
"""
"""
super
(
Quant
ization
,
self
).
__init__
(
"Quantization
"
)
super
(
Quant
Aware
,
self
).
__init__
(
"QuantAware
"
)
self
.
quantize_op_types
=
quantize_op_types
self
.
quantize_op_types
=
quantize_op_types
self
.
weight_bits
=
weight_bits
self
.
weight_bits
=
weight_bits
self
.
activation_bits
=
activation_bits
self
.
activation_bits
=
activation_bits
...
...
tests/act/qat_dist_train.yaml
浏览文件 @
c90ab602
# For unittests
# For unittests
Quant
ization
:
Quant
Aware
:
quantize_op_types
:
quantize_op_types
:
-
conv2d
-
conv2d
-
depthwise_conv2d
-
depthwise_conv2d
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录