Files
FastDeploy/tools/README.md
yunyaoXYY 29f034cf93 [Quantization] Update auto compression configs files. (#846)
* Fix links in readme

* Fix links in readme

* Update PPOCRv2/v3 examples

* Update auto compression configs
2022-12-11 14:16:13 +08:00

75 lines
2.5 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# FastDeploy 工具包
FastDeploy提供了一系列高效易用的工具优化部署体验, 提升推理性能.
- [1.自动压缩工具包](#1)
- [2.模型转换工具包](#2)
<p id="1"></p>
## 一键模型自动化压缩工具
FastDeploy基于PaddleSlim的Auto Compression Toolkit(ACT), 给用户提供了一键模型自动化压缩的工具, 用户可以轻松地通过一行命令对模型进行自动化压缩, 并在FastDeploy上部署压缩后的模型, 提升推理速度. 本文档将以FastDeploy一键模型自动化压缩工具为例, 介绍如何安装此工具, 并提供相应的使用文档.
### 环境准备
1.用户参考PaddlePaddle官网, 安装Paddle 2.4 版本
```
https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html
```
2.安装PaddleSlim 2.4 版本
```bash
pip install paddleslim==2.4.0
```
3.安装fastdeploy-tools工具包
```bash
# 通过pip安装fastdeploy-tools. 此工具包目前支持模型一键自动化压缩和模型转换的功能.
# FastDeploy的python包已包含此工具, 不需重复安装.
pip install fastdeploy-tools==0.0.1
```
### 一键模型自动化压缩工具的使用
按照以上步骤成功安装后,即可使用FastDeploy一键模型自动化压缩工具, 示例如下.
```bash
fastdeploy compress --config_path=./configs/detection/yolov5s_quant.yaml --method='PTQ' --save_dir='./yolov5s_ptq_model/'
```
详细使用文档请参考[FastDeploy一键模型自动化压缩工具](./common_tools/auto_compression/README.md)
<p id="2"></p>
## 模型转换工具
FastDeploy 基于 X2Paddle 为用户提供了模型转换的工具, 用户可以轻松地通过一行命令将外部框架模型快速迁移至飞桨框架,目前支持 ONNX、TensorFlow 以及 Caffe支持大部分主流的CV和NLP的模型转换。
### 环境准备
1. PaddlePaddle 安装,可参考如下文档快速安装
```
https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html
```
2. X2Paddle 安装
如需使用稳定版本可通过pip方式安装X2Paddle
```shell
pip install x2paddle
```
如需体验最新功能,可使用源码安装方式:
```shell
git clone https://github.com/PaddlePaddle/X2Paddle.git
cd X2Paddle
python setup.py install
```
### 使用方式
按照以上步骤成功安装后,即可使用 FastDeploy 一键转换工具, 示例如下:
```bash
fastdeploy convert --framework onnx --model yolov5s.onnx --save_dir pd_model
```
更多详细内容可参考[X2Paddle](https://github.com/PaddlePaddle/X2Paddle)