mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-07 09:31:35 +08:00
[Quantization] Improve the usage of fastdeploy tools (#722)
Improve the usage of fastdeploy tools
This commit is contained in:
@@ -40,10 +40,10 @@ wget https://bj.bcebos.com/paddlehub/fastdeploy/COCO_val_320.tar.gz
|
||||
tar -xvf COCO_val_320.tar.gz
|
||||
```
|
||||
|
||||
##### 2.使用fastdeploy --auto_compress命令,执行一键模型自动化压缩:
|
||||
##### 2.使用fastdeploy compress命令,执行一键模型自动化压缩:
|
||||
以下命令是对yolov5s模型进行量化, 用户若想量化其他模型, 替换config_path为configs文件夹下的其他模型配置文件即可.
|
||||
```shell
|
||||
fastdeploy --auto_compress --config_path=./configs/detection/yolov5s_quant.yaml --method='PTQ' --save_dir='./yolov5s_ptq_model/'
|
||||
fastdeploy compress --config_path=./configs/detection/yolov5s_quant.yaml --method='PTQ' --save_dir='./yolov5s_ptq_model/'
|
||||
```
|
||||
|
||||
##### 3.参数说明
|
||||
@@ -74,12 +74,12 @@ wget https://bj.bcebos.com/paddlehub/fastdeploy/COCO_train_320.tar
|
||||
tar -xvf COCO_train_320.tar
|
||||
```
|
||||
|
||||
##### 2.使用fastdeploy --auto_compress命令,执行一键模型自动化压缩:
|
||||
##### 2.使用fastdeploy compress命令,执行一键模型自动化压缩:
|
||||
以下命令是对yolov5s模型进行量化, 用户若想量化其他模型, 替换config_path为configs文件夹下的其他模型配置文件即可.
|
||||
```shell
|
||||
# 执行命令默认为单卡训练,训练前请指定单卡GPU, 否则在训练过程中可能会卡住.
|
||||
export CUDA_VISIBLE_DEVICES=0
|
||||
fastdeploy --auto_compress --config_path=./configs/detection/yolov5s_quant.yaml --method='QAT' --save_dir='./yolov5s_qat_model/'
|
||||
fastdeploy compress --config_path=./configs/detection/yolov5s_quant.yaml --method='QAT' --save_dir='./yolov5s_qat_model/'
|
||||
```
|
||||
|
||||
##### 3.参数说明
|
||||
|
@@ -46,12 +46,12 @@ wget https://bj.bcebos.com/paddlehub/fastdeploy/COCO_val_320.tar.gz
|
||||
tar -xvf COCO_val_320.tar.gz
|
||||
```
|
||||
|
||||
##### 2. Run fastdeploy --auto_compress command to compress the model
|
||||
##### 2. Run fastdeploy compress command to compress the model
|
||||
|
||||
The following command is to quantize the yolov5s model, if developers want to quantize other models, replace the config_path with other model configuration files in the configs folder.
|
||||
|
||||
```shell
|
||||
fastdeploy --auto_compress --config_path=./configs/detection/yolov5s_quant.yaml --method='PTQ' --save_dir='./yolov5s_ptq_model/'
|
||||
fastdeploy compress --config_path=./configs/detection/yolov5s_quant.yaml --method='PTQ' --save_dir='./yolov5s_ptq_model/'
|
||||
```
|
||||
|
||||
[notice] PTQ is short for post-training quantization
|
||||
@@ -83,14 +83,14 @@ wget https://bj.bcebos.com/paddlehub/fastdeploy/COCO_val_320.tar.gz
|
||||
tar -xvf COCO_val_320.tar.gz
|
||||
```
|
||||
|
||||
##### 2.Use fastdeploy --auto_compress command to compress models
|
||||
##### 2.Use fastdeploy compress command to compress models
|
||||
|
||||
The following command is to quantize the yolov5s model, if developers want to quantize other models, replace the config_path with other model configuration files in the configs folder.
|
||||
|
||||
```shell
|
||||
# Please specify the single card GPU before training, otherwise it may get stuck during the training process.
|
||||
export CUDA_VISIBLE_DEVICES=0
|
||||
fastdeploy --auto_compress --config_path=./configs/detection/yolov5s_quant.yaml --method='QAT' --save_dir='./yolov5s_qat_model/'
|
||||
fastdeploy compress --config_path=./configs/detection/yolov5s_quant.yaml --method='QAT' --save_dir='./yolov5s_qat_model/'
|
||||
```
|
||||
|
||||
##### 3.Parameters
|
||||
|
0
tools/common_tools/auto_compression/__init__.py
Normal file
0
tools/common_tools/auto_compression/__init__.py
Normal file
@@ -1 +0,0 @@
|
||||
import fd_auto_compress
|
||||
|
@@ -22,7 +22,7 @@ import paddle
|
||||
from paddleslim.common import load_config, load_onnx_model
|
||||
from paddleslim.auto_compression import AutoCompression
|
||||
from paddleslim.quant import quant_post_static
|
||||
from fd_auto_compress.dataset import *
|
||||
from .dataset import *
|
||||
|
||||
|
||||
def argsparser():
|
||||
|
Reference in New Issue
Block a user