Paddle2ONNX
简体中文 | English
1 Paddle2ONNX 简介
Paddle2ONNX 支持将 PaddlePaddle 模型格式转化到 ONNX 模型格式。通过 ONNX 可以完成将 Paddle 模型到多种推理引擎的部署,包括 TensorRT/OpenVINO/MNN/TNN/NCNN,以及其它对 ONNX 开源格式进行支持的推理引擎或硬件。
2 Paddle2ONNX 环境依赖
Paddle2ONNX 依赖PaddlePaddle3.0,我们建议您在以下环境下使用 Paddle2ONNX :
- PaddlePaddle == 3.0.0
- onnxruntime >= 1.10.0
3 安装 Paddle2ONNX
如果您只是想要安装 Paddle2ONNX 且没有二次开发的需求,你可以通过执行以下代码来快速安装 Paddle2ONNX
pip install paddle2onnx
如果你希望对 Paddle2ONNX 进行二次开发,请按照Github 源码安装方式编译Paddle2ONNX。
4 快速使用教程
4.1 获取PaddlePaddle部署模型
Paddle2ONNX 在导出模型时,需要传入部署模型格式,包括两个文件
model_name.json: 表示模型结构model_name.pdiparams: 表示模型参数
4.2 调整Paddle模型
如果对Paddle模型的输入输出需要做调整,可以前往Paddle 相关工具查看教程。
4.3 使用命令行转换 PaddlePaddle 模型
你可以通过使用命令行并通过以下命令将Paddle模型转换为ONNX模型
paddle2onnx --model_dir model_dir \
--model_filename model.json \
--params_filename model.pdiparams \
--save_file model.onnx
可调整的转换参数如下表:
| 参数 | 参数说明 |
|---|---|
| --model_dir | 配置包含 Paddle 模型的目录路径 |
| --model_filename | [可选] 配置位于 --model_dir 下存储网络结构的文件名 |
| --params_filename | [可选] 配置位于 --model_dir 下存储模型参数的文件名 |
| --save_file | 指定转换后的模型保存目录路径 |
| --opset_version | [可选] 配置转换为ONNX的OpSet版本,目前支持7~19等多个版本,默认为 9 |
| --enable_auto_update_opset | [可选] 是否开启opset version自动升级功能,当低版本opset无法转换时,自动选择更高版本的opset进行转换, 默认为 True |
| --enable_onnx_checker | [可选] 配置是否检查导出为 ONNX 模型的正确性, 建议打开此开关, 默认为 True |
| --enable_dist_prim_all | [可选] 是否开启组合算子拆解,默为 False |
| --optimize_tool | [可选] ONNX模型优化工具,可选择onnxoptimizer、polygraphy、None, 默认为 onnxoptimizer |
| --enable_verbose | [可选] 是否打印更更详细的日志信息,默认为 False |
| --version | [可选] 查看 paddle2onnx 版本 |
4.4 裁剪ONNX
如果你需要调整 ONNX 模型,请参考 ONNX 相关工具
4.5 优化ONNX
如你对导出的 ONNX 模型有优化的需求,推荐使用 onnxslim 对模型进行优化:
pip install onnxslim
onnxslim model.onnx slim.onnx
5 代码贡献
繁荣的生态需要大家的携手共建,开发者可以参考 Paddle2ONNX 贡献指南 来为 Paddle2ONNX 贡献代码。
6 License
Provided under the Apache-2.0 license.
7 感谢捐赠
Metadata
Release files for paddle2onnx 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 58.9 MB
Release files / paddle2onnx-2.1.0-cp312-cp312-win_amd64.whl
| Download URL | paddle2onnx-2.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
55fe0b6eba1227b3a9b362a0881f60a3fedb4c6251c3de7d42f0113ab26bbbf9
|
|
BLAKE2b-256 checksum How to use checksums |
9fb1b7a4b875cd61063dd5945fde212925493042a7e9f2a9346afa401e3d1510
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / paddle2onnx-2.1.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | paddle2onnx-2.1.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
7fef03d6c40bbe5e2ebc6e895b25b8860acd28803601195884e8ffec5ffa1109
|
|
BLAKE2b-256 checksum How to use checksums |
0653a775d7e27318f7a2f80ed494c28d8ede7a32359bf0f01c16444aaf3a9044
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | paddle2onnx-2.1.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
f4ce08eb1be27553adbda65bff01c96713a5d2d0b1219062bf7c4107e971285f
|
|
BLAKE2b-256 checksum How to use checksums |
f10d8ba572c1e41d34504ffc40e895216e7c74ba28e6f45f5e278f51a0bfa4f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp312-cp312-macosx_12_0_universal2.whl
| Download URL | paddle2onnx-2.1.0-cp312-cp312-macosx_12_0_universal2.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.12 macOS 12.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
0c45e24ff9174f2e74d01e93cbcca98fa84c5030499f87f333d3d4d6452b3b08
|
|
BLAKE2b-256 checksum How to use checksums |
4fac6d6ac7e3dd8c36649131eda15f36230e6595cb31b46f0e45c59db390e72f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / paddle2onnx-2.1.0-cp311-cp311-win_amd64.whl
| Download URL | paddle2onnx-2.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
478993e17ed0212b79a4d6e2d8d0582ebb19c7230b7f365d51222833e98581b3
|
|
BLAKE2b-256 checksum How to use checksums |
c1c70f29de6caa243e1d951f378d69b311da51d0bd6d944778e36def9266d990
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / paddle2onnx-2.1.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | paddle2onnx-2.1.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b21af246598deb3b0ee4b2b5c3c671816e0f29b3594c5b311cbe6e356dffca8c
|
|
BLAKE2b-256 checksum How to use checksums |
e5a196ae5163999567d7104f20f09c391810fc025c47c78da23216a8c5668f63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | paddle2onnx-2.1.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
f2f357001a935419ed4abc1463d78fa4606553e783793b9a8fe5876129d9d315
|
|
BLAKE2b-256 checksum How to use checksums |
13ae4a1b0e9ab7b815782d76c921bf462d8c8d146c164a56d29861cf6b45d9d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp311-cp311-macosx_12_0_universal2.whl
| Download URL | paddle2onnx-2.1.0-cp311-cp311-macosx_12_0_universal2.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.11 macOS 12.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
1f412901114faf76ab715bf948f9b44dd1fdebb39657ccb8cdfc381d2d7ca641
|
|
BLAKE2b-256 checksum How to use checksums |
3402a34e24c0eb098084f0f21a36b682da9ac148a2b44c54c34078e127f8153e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / paddle2onnx-2.1.0-cp310-cp310-win_amd64.whl
| Download URL | paddle2onnx-2.1.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
327ba7b5e0174054e315ed8f5983755000ff5e56844b6f394d55a5156b11e158
|
|
BLAKE2b-256 checksum How to use checksums |
be95bdda235cd820cd5062713f1a9a89b33b4a19d0aca6ef13d9e2211e5ff1d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Release files / paddle2onnx-2.1.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | paddle2onnx-2.1.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2d69e0d1bd96a8d80452dfd7fda9e8869ff37f333c0a504530983baf5f221b21
|
|
BLAKE2b-256 checksum How to use checksums |
5731b9fb0b373f7a0db4e39c8cb4a708b4a016920e284b5b37dffae8ab7dac90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | paddle2onnx-2.1.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.10 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
c744ec54b43f7b1050b1e1d9d429786e684950a62fc3b274efd2afcb00cde552
|
|
BLAKE2b-256 checksum How to use checksums |
2f286539a7f5d8b7ea1a5f322a2cd2ba60734c1321608152a1761db559c1c45e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp310-cp310-macosx_12_0_universal2.whl
| Download URL | paddle2onnx-2.1.0-cp310-cp310-macosx_12_0_universal2.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.10 macOS 12.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
c1c4e3e2996044ea4f67b8e3af90da08d86962aa411286532012c72f271bab5d
|
|
BLAKE2b-256 checksum How to use checksums |
aa7b0807064f09428609cc02b8ada510bb31c1df8db5316597a41a0769e62143
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Release files / paddle2onnx-2.1.0-cp39-cp39-win_amd64.whl
| Download URL | paddle2onnx-2.1.0-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2b205945d058cbb3cb2e322408bf279f8e746aaeb85b51c0f3e461708af40686
|
|
BLAKE2b-256 checksum How to use checksums |
ffa370eca4fd0e818dada6f0058567c529dd3f3ac850b3aec40c4e70a3af01bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.13
|
Release files / paddle2onnx-2.1.0-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | paddle2onnx-2.1.0-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.9 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
289c56d041ee51b9e70d42b0262d4cf93d931ad8c8bc23441c25881f78d18786
|
|
BLAKE2b-256 checksum How to use checksums |
d18fb007aa8e4d2b2924a335fd14e0be41e3731c33c20f5b7a5426f057e50d90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | paddle2onnx-2.1.0-cp39-cp39-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.9 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
25ae5c20210166a1692acd5414fc9f50307f45bdd0a4aee2fb755ca08bda27b3
|
|
BLAKE2b-256 checksum How to use checksums |
46c3de304aaa2e96ef3a6e38c5d1b66e3d77efe8d2e25c0f87820286d3fb71f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp39-cp39-macosx_12_0_universal2.whl
| Download URL | paddle2onnx-2.1.0-cp39-cp39-macosx_12_0_universal2.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.9 macOS 12.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
53c52eb28ce7785459dfd75ea930d0e4a316982384ca65b950ace1075648252f
|
|
BLAKE2b-256 checksum How to use checksums |
a9a0148f216002ea760c43945ff9d0d794ae8204529fe2017d739e1719bf0a83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.13
|
Release files / paddle2onnx-2.1.0-cp38-cp38-win_amd64.whl
| Download URL | paddle2onnx-2.1.0-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
141eca67a2f2af4033a4b26e746e0c987ea4d4468bd102802cd408cc28fe17ad
|
|
BLAKE2b-256 checksum How to use checksums |
c0acea558b624c22d7044cc245d54b1fd0955b5da58ffd2ad7622e7923b36562
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.10
|
Release files / paddle2onnx-2.1.0-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | paddle2onnx-2.1.0-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.8 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1619149ca27dd1dc282f7497ef152c96a36738a9ee9f88ecac2e20203ab9b39a
|
|
BLAKE2b-256 checksum How to use checksums |
cd6cb467b89ba461dd71109ae9ac311cc800370f5153b0ed8c17971a8db45297
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp38-cp38-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | paddle2onnx-2.1.0-cp38-cp38-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.8 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
792474f6fe612116a850e7f0f33d162d90f8c7a1cfa60e9bdf2cc6a80b1bda85
|
|
BLAKE2b-256 checksum How to use checksums |
591d26f3ce1fb98469779031e04f81a691fa17f7ac59f046117a668d483e9f49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / paddle2onnx-2.1.0-cp38-cp38-macosx_12_0_universal2.whl
| Download URL | paddle2onnx-2.1.0-cp38-cp38-macosx_12_0_universal2.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.8 macOS 12.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
b00ae06bcd212264135399e1667e14bf21a5a195c0e4b429bb6ba6f8df9e04a8
|
|
BLAKE2b-256 checksum How to use checksums |
a21c1bc0009b5b57440038320699548e70f055be464e34d8acbe3f9a7151d602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.10
|
Security for paddle2onnx 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.