Skip to content

Commit 4766864

Browse files
author
Varun Arora
committed
Minor fixes based on @kuke's feedback
1 parent 718f154 commit 4766864

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

doc/fluid/design/onnx/onnx_convertor.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
Therefore, it is necessary to enable the conversion between PaddlePaddle and ONNX. This design doc is aimed at implementing a convertor, mainly for converting between **Fluid** models and ONNX (it is very likely that we may support older v2 models in the future). A complete convertor should be bidirectional - with a frontend AND a backend, but considering the importance, the we will start with the frontend i.e. Fluid models to ONNX models.
66

7-
One thing that makes it doable in Fluid's case is the use of a static IR - the `ProgramDesc` - as opposed to a dynamic graph, as created in the cases of frameworks like PyTorch.
8-
97

108
# How it works
119

@@ -24,6 +22,8 @@ Here are a few major considerations when it comes to converting models:
2422
2. Checking to see if the generated nodes on the graph are validated by the internal ONNX checkers.
2523
- **Versioning**: ONNX versions its op listing over versions. In fact, it has versioning on 3 different levels: ops, graphs, and ONNX models. This requires that we are conscious about versioning the convertor and updating tests and op convertor logic for each release. It also implies that we release pre-trained ONNX models upon each version release.
2624

25+
One thing that makes this conversion more feasible in Fluid's case is the use of a static IR - the `ProgramDesc` - as opposed to a dynamic graph, as created in the cases of frameworks like PyTorch.
26+
2727

2828
# Project structure
2929

@@ -45,11 +45,17 @@ The project contains four important parts:
4545
# Usage
4646
The converter should be designed to very easy-to-use. Bidirectional conversion between a Fluid inference model and an ONNX binary model will be supported. Model validation will also provided to verify the correctness of converted model.
4747

48-
* Fluid inference model to ONNX binary model
48+
* Convert Fluid inference model to ONNX binary model
49+
50+
```
51+
python convert.py --fluid_model <fluid inference model> --onnx_model <ONNX model> validate True
52+
```
53+
54+
* Validate the converted model
4955
50-
```
51-
python convert.py --fluid_model <fluid inference model> --onnx_model <ONNX model> validate True
52-
```
56+
```
57+
python validate.py --fluid_model <fluid inference model> --onnx_model <ONNX model>
58+
```
5359
5460
The conversion and model validation will be completed consecutively, finally output a readable model structure description. And for the converse conversion, users only need to exchange the input and output.
5561

0 commit comments

Comments
 (0)