From 29f034cf93d25f8a2b282d0b43cfd595ebe3640a Mon Sep 17 00:00:00 2001 From: yunyaoXYY <109218879+yunyaoXYY@users.noreply.github.com> Date: Sun, 11 Dec 2022 14:16:13 +0800 Subject: [PATCH] [Quantization] Update auto compression configs files. (#846) * Fix links in readme * Fix links in readme * Update PPOCRv2/v3 examples * Update auto compression configs --- tools/README.md | 7 +++---- tools/README_EN.md | 7 +++---- tools/common_tools/auto_compression/README.md | 7 +++---- tools/common_tools/auto_compression/README_EN.md | 9 +++------ tools/common_tools/auto_compression/configs/README.md | 2 +- tools/common_tools/auto_compression/configs/README_EN.md | 2 +- .../configs/classification/mobilenetv1_ssld_quant.yaml | 2 +- .../configs/classification/resnet50_vd_quant.yaml | 2 +- .../configs/detection/ppyoloe_plus_withNMS_quant.yaml | 2 +- .../configs/detection/ppyoloe_withNMS_quant.yaml | 2 +- .../configs/detection/yolov5s_quant.yaml | 2 +- .../configs/detection/yolov6s_quant.yaml | 3 ++- .../auto_compression/configs/detection/yolov7_quant.yaml | 2 +- .../configs/segmentation/pp_liteseg_quant.yaml | 2 +- 14 files changed, 23 insertions(+), 28 deletions(-) diff --git a/tools/README.md b/tools/README.md index 7a0e5b668..07c7ac8a6 100755 --- a/tools/README.md +++ b/tools/README.md @@ -11,15 +11,14 @@ FastDeploy提供了一系列高效易用的工具优化部署体验, 提升推 FastDeploy基于PaddleSlim的Auto Compression Toolkit(ACT), 给用户提供了一键模型自动化压缩的工具, 用户可以轻松地通过一行命令对模型进行自动化压缩, 并在FastDeploy上部署压缩后的模型, 提升推理速度. 本文档将以FastDeploy一键模型自动化压缩工具为例, 介绍如何安装此工具, 并提供相应的使用文档. ### 环境准备 -1.用户参考PaddlePaddle官网, 安装develop版本 +1.用户参考PaddlePaddle官网, 安装Paddle 2.4 版本 ``` https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html ``` -2.安装PaddleSlim develop版本 +2.安装PaddleSlim 2.4 版本 ```bash -git clone https://github.com/PaddlePaddle/PaddleSlim.git & cd PaddleSlim -python setup.py install +pip install paddleslim==2.4.0 ``` 3.安装fastdeploy-tools工具包 diff --git a/tools/README_EN.md b/tools/README_EN.md index 5c1e2501f..422b477d4 100755 --- a/tools/README_EN.md +++ b/tools/README_EN.md @@ -11,15 +11,14 @@ FastDeploy provides a series of efficient and easy-to-use tools to optimize the Based on PaddleSlim's Auto Compression Toolkit (ACT), FastDeploy provides users with a one-click model automation compression tool that allows users to easily compress the model with a single command. This document will take FastDeploy's one-click model automation compression tool as an example, introduce how to install the tool, and provide the corresponding documentation for usage. ### Environmental Preparation -1.Install PaddlePaddle develop version +1.Install PaddlePaddle 2.4 version ``` https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html ``` -2.Install PaddleSlim dev version +2.Install PaddleSlim 2.4 version ```bash -git clone https://github.com/PaddlePaddle/PaddleSlim.git & cd PaddleSlim -python setup.py install +pip install paddleslim==2.4.0 ``` 3.Install fastdeploy-tools package diff --git a/tools/common_tools/auto_compression/README.md b/tools/common_tools/auto_compression/README.md index a990eeaa3..7c1b3feac 100644 --- a/tools/common_tools/auto_compression/README.md +++ b/tools/common_tools/auto_compression/README.md @@ -6,15 +6,14 @@ FastDeploy基于PaddleSlim的Auto Compression Toolkit(ACT), 给用户提供了 ### 环境依赖 -1.用户参考PaddlePaddle官网, 安装develop版本 +1.用户参考PaddlePaddle官网, 安装Paddle 2.4 版本 ``` https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html ``` -2.安装paddleslim-develop版本 +2.安装PaddleSlim 2.4 版本 ```bash -git clone https://github.com/PaddlePaddle/PaddleSlim.git & cd PaddleSlim -python setup.py install +pip install paddleslim==2.4.0 ``` ### 一键模型自动化压缩工具安装方式 diff --git a/tools/common_tools/auto_compression/README_EN.md b/tools/common_tools/auto_compression/README_EN.md index 9c591208d..fb1480819 100644 --- a/tools/common_tools/auto_compression/README_EN.md +++ b/tools/common_tools/auto_compression/README_EN.md @@ -7,17 +7,14 @@ We take the Yolov5 series as an example to demonstrate how to install and execut ### Environment Dependencies -1. Install the develop version downloaded from PaddlePaddle official website. - +1.Install PaddlePaddle 2.4 version ``` https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html ``` -2.Install PaddleSlim-develop - +2.Install PaddleSlim 2.4 version ```bash -git clone https://github.com/PaddlePaddle/PaddleSlim.git & cd PaddleSlim -python setup.py install +pip install paddleslim==2.4.0 ``` ### Install Fastdeploy Auto Compression Toolkit diff --git a/tools/common_tools/auto_compression/configs/README.md b/tools/common_tools/auto_compression/configs/README.md index 992402656..3c71ad41d 100644 --- a/tools/common_tools/auto_compression/configs/README.md +++ b/tools/common_tools/auto_compression/configs/README.md @@ -24,7 +24,7 @@ Distillation: alpha: 1.0 #蒸馏loss所占权重 loss: soft_label #蒸馏loss算法 -Quantization: +QuantAware: onnx_format: true #是否采用ONNX量化标准格式, 要在FastDeploy上部署, 必须选true use_pact: true #量化训练是否使用PACT方法 activation_quantize_type: 'moving_average_abs_max' #激活量化方式 diff --git a/tools/common_tools/auto_compression/configs/README_EN.md b/tools/common_tools/auto_compression/configs/README_EN.md index c1066409c..8381105eb 100644 --- a/tools/common_tools/auto_compression/configs/README_EN.md +++ b/tools/common_tools/auto_compression/configs/README_EN.md @@ -26,7 +26,7 @@ Distillation: alpha: 1.0 #Distillation loss weight loss: soft_label #Distillation loss algorithm -Quantization: +QuantAware: onnx_format: true #Whether to use ONNX quantization standard format or not, must be true to deploy on FastDeploy use_pact: true #Whether to use the PACT method for training activation_quantize_type: 'moving_average_abs_max' #Activations quantization methods diff --git a/tools/common_tools/auto_compression/configs/classification/mobilenetv1_ssld_quant.yaml b/tools/common_tools/auto_compression/configs/classification/mobilenetv1_ssld_quant.yaml index 7fa979110..22fe14c63 100644 --- a/tools/common_tools/auto_compression/configs/classification/mobilenetv1_ssld_quant.yaml +++ b/tools/common_tools/auto_compression/configs/classification/mobilenetv1_ssld_quant.yaml @@ -17,7 +17,7 @@ Distillation: - softmax_0.tmp_0 -Quantization: +QuantAware: use_pact: true activation_bits: 8 is_full_quantize: false diff --git a/tools/common_tools/auto_compression/configs/classification/resnet50_vd_quant.yaml b/tools/common_tools/auto_compression/configs/classification/resnet50_vd_quant.yaml index 6de409ac7..4197bf3d5 100644 --- a/tools/common_tools/auto_compression/configs/classification/resnet50_vd_quant.yaml +++ b/tools/common_tools/auto_compression/configs/classification/resnet50_vd_quant.yaml @@ -16,7 +16,7 @@ Distillation: node: - softmax_0.tmp_0 -Quantization: +QuantAware: use_pact: true activation_bits: 8 is_full_quantize: false diff --git a/tools/common_tools/auto_compression/configs/detection/ppyoloe_plus_withNMS_quant.yaml b/tools/common_tools/auto_compression/configs/detection/ppyoloe_plus_withNMS_quant.yaml index 2b9f8d7a4..8c4f98257 100644 --- a/tools/common_tools/auto_compression/configs/detection/ppyoloe_plus_withNMS_quant.yaml +++ b/tools/common_tools/auto_compression/configs/detection/ppyoloe_plus_withNMS_quant.yaml @@ -14,7 +14,7 @@ Distillation: alpha: 1.0 loss: soft_label -Quantization: +QuantAware: onnx_format: true use_pact: true activation_quantize_type: 'moving_average_abs_max' diff --git a/tools/common_tools/auto_compression/configs/detection/ppyoloe_withNMS_quant.yaml b/tools/common_tools/auto_compression/configs/detection/ppyoloe_withNMS_quant.yaml index e46c11b27..2d1a2536b 100644 --- a/tools/common_tools/auto_compression/configs/detection/ppyoloe_withNMS_quant.yaml +++ b/tools/common_tools/auto_compression/configs/detection/ppyoloe_withNMS_quant.yaml @@ -14,7 +14,7 @@ Distillation: alpha: 1.0 loss: soft_label -Quantization: +QuantAware: onnx_format: true use_pact: true activation_quantize_type: 'moving_average_abs_max' diff --git a/tools/common_tools/auto_compression/configs/detection/yolov5s_quant.yaml b/tools/common_tools/auto_compression/configs/detection/yolov5s_quant.yaml index 72cfef9ba..9d6b507cf 100644 --- a/tools/common_tools/auto_compression/configs/detection/yolov5s_quant.yaml +++ b/tools/common_tools/auto_compression/configs/detection/yolov5s_quant.yaml @@ -14,7 +14,7 @@ Distillation: alpha: 1.0 loss: soft_label -Quantization: +QuantAware: onnx_format: true use_pact: true activation_quantize_type: 'moving_average_abs_max' diff --git a/tools/common_tools/auto_compression/configs/detection/yolov6s_quant.yaml b/tools/common_tools/auto_compression/configs/detection/yolov6s_quant.yaml index ee4986312..44b8bd472 100644 --- a/tools/common_tools/auto_compression/configs/detection/yolov6s_quant.yaml +++ b/tools/common_tools/auto_compression/configs/detection/yolov6s_quant.yaml @@ -14,12 +14,13 @@ Distillation: alpha: 1.0 loss: soft_label -Quantization: +QuantAware: onnx_format: true activation_quantize_type: 'moving_average_abs_max' quantize_op_types: - conv2d - depthwise_conv2d + - conv2d_transpose PTQ: diff --git a/tools/common_tools/auto_compression/configs/detection/yolov7_quant.yaml b/tools/common_tools/auto_compression/configs/detection/yolov7_quant.yaml index e6cc2c9a9..5e056e94c 100644 --- a/tools/common_tools/auto_compression/configs/detection/yolov7_quant.yaml +++ b/tools/common_tools/auto_compression/configs/detection/yolov7_quant.yaml @@ -14,7 +14,7 @@ Distillation: alpha: 1.0 loss: soft_label -Quantization: +QuantAware: onnx_format: true activation_quantize_type: 'moving_average_abs_max' quantize_op_types: diff --git a/tools/common_tools/auto_compression/configs/segmentation/pp_liteseg_quant.yaml b/tools/common_tools/auto_compression/configs/segmentation/pp_liteseg_quant.yaml index 9c04f65d3..beddb370d 100644 --- a/tools/common_tools/auto_compression/configs/segmentation/pp_liteseg_quant.yaml +++ b/tools/common_tools/auto_compression/configs/segmentation/pp_liteseg_quant.yaml @@ -17,7 +17,7 @@ Distillation: node: - conv2d_94.tmp_0 -Quantization: +QuantAware: onnx_format: True quantize_op_types: - conv2d