Giter VIP home page Giter VIP logo

paddle2onnx's Introduction

Paddle2ONNX

简体中文 | English

1 简介

Paddle2ONNX 支持将 PaddlePaddle 模型格式转化到 ONNX 模型格式。通过 ONNX 可以完成将 Paddle 模型到多种推理引擎的部署,包括 TensorRT/OpenVINO/MNN/TNN/NCNN,以及其它对 ONNX 开源格式进行支持的推理引擎或硬件。

2 环境依赖

  • PaddlePaddle == 2.6.0
  • onnxruntime >= 1.10.0

3 安装

pip install paddle2onnx

开发用户,请按照Github 源码安装方式编译Paddle2ONNX。

4 使用

4.1 获取PaddlePaddle部署模型

Paddle2ONNX 在导出模型时,需要传入部署模型格式,包括两个文件

  • model_name.pdmodel: 表示模型结构
  • model_name.pdiparams: 表示模型参数 [注意] 这里需要注意,两个文件其中参数文件后辍为 .pdiparams,如你的参数文件后辍是 .pdparams ,那说明你的参数是训练过程中保存的,当前还不是部署模型格式。 部署模型的导出可以参照各个模型套件的导出模型文档。

4.2 调整Paddle模型

如果对Paddle模型的输入输出需要做调整,可以前往Paddle 相关工具查看教程。

4.3 命令行转换

使用如下命令将Paddle模型转换为ONNX模型

paddle2onnx --model_dir saved_inference_model \
            --model_filename model.pdmodel \
            --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~16 等多个版本,默认为 9
--enable_onnx_checker [可选] 配置是否检查导出为 ONNX 模型的正确性, 建议打开此开关, 默认为 False
--enable_auto_update_opset [可选] 是否开启 opset version 自动升级功能,当低版本 opset 无法转换时,自动选择更高版本的 opset进行转换, 默认为 True
--deploy_backend [可选] 量化模型部署的推理引擎,支持 onnxruntime、tensorrt 或 others,当选择 others 时,所有的量化信息存储于 max_range.txt 文件中,默认为 onnxruntime
--save_calibration_file [可选] TensorRT 8.X版本部署量化模型需要读取的 cache 文件的保存路径,默认为 calibration.cache
--version [可选] 查看 paddle2onnx 版本
--external_filename [可选] 当导出的 ONNX 模型大于 2G 时,需要设置 external data 的存储路径,推荐设置为:external_data
--export_fp16_model [可选] 是否将导出的 ONNX 的模型转换为 FP16 格式,并用 ONNXRuntime-GPU 加速推理,默认为 False
--custom_ops [可选] 将 Paddle OP 导出为 ONNX 的 Custom OP,例如:--custom_ops '{"paddle_op":"onnx_op"},默认为 {}

4.4 裁剪ONNX

如果你需要调整 ONNX 模型,请参考如下工具:ONNX 相关工具

4.5 优化ONNX

如你对导出的 ONNX 模型有优化的需求,推荐使用 onnx-simplifier,也可使用如下命令对模型进行优化

python -m paddle2onnx.optimize --input_model model.onnx --output_model new_model.onnx

5 License

Provided under the Apache-2.0 license.

6 捐赠

  • 感谢 PaddlePaddle 团队提供服务器支持 Paddle2ONNX 的 CI 建设。
  • 感谢社区用户 chenwhqlluotao1goocodyjeff41404jzhang553ZhengBicheng 于2024年03月28日向 Paddle2ONNX PMC 捐赠共 10000 元人名币用于 Paddle2ONNX 的发展。

paddle2onnx's People

Contributors

aipioneer avatar channingss avatar chunyuwei avatar cjt222 avatar deftruth avatar dependabot[bot] avatar feifei-111 avatar felixhjh avatar franva avatar heliqi avatar jiangjiajun avatar jzhang533 avatar ltcs11 avatar neonhuang avatar onecatcn avatar pkuyym avatar rainyfly avatar rollroll90 avatar samdm avatar sidgoyal78 avatar sunahong1993 avatar tsocha avatar wangwin avatar wawltor avatar wjj19950828 avatar xsrobin avatar yeliang2258 avatar zeref996 avatar zeyuchen avatar zheng-bicheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paddle2onnx's Issues

paddle转onnx出错

Python:Python 3.7
转换框架版本:PaddlePaddle 1.5.1
paddledetecton0.1: darnet yolov3 训练的模型
paddle2onnx: 0.2
*训练参数和模型:*https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.1/configs/yolov3_darknet_voc.yml

使用转换命令:paddle2onnx --fluid_model mj_yolov3_darknet/ --fluid_model_name mj_yolov3_darknet/model --fluid_params_name mj_yolov3_darknet/params --onnx_model mjy3
得到的结果,出错信息

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
----------- Configuration Arguments -----------
check_task: image_classification
debug: False
fluid_model: mj_yolov3_darknet/
fluid_model_name: mj_yolov3_darknet/model
fluid_params_name: mj_yolov3_darknet/params
image_path:
name_prefix:
onnx_model: mjy3
return_variable: False
to_print_model: False

load the model parameter done.
The operator sets to run test case.
{'concat', 'multiclass_nms', 'scale', 'conv2d', 'leaky_relu', 'batch_norm', 'yolo_box', 'nearest_interp', 'elementwise_add', 'transpose2'}
Traceback (most recent call last):
File "/opt/conda/envs/python35-paddle120-env/bin/paddle2onnx", line 10, in
sys.exit(main())
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/fluid_onnx/fluid_to_onnx.py", line 230, in main
convert(args)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/fluid_onnx/fluid_to_onnx.py", line 194, in convert
checker.check_model(onnx_model)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/onnx/checker.py", line 91, in check_model
C.check_model(model.SerializeToString())
onnx.onnx_cpp2py_export.checker.ValidationError: Node () has input size 0 not in range [min=1, max=1].

==> Context: Bad node spec: output: "nearest_interp_0.tmp_0@out_size_f" op_type: "Cast" attribute { name: "to" i: 1 type: INT }
@cjt222

Loading Paddle parameters

We need to figure out whether Paddle params will be read:

  • in C++ using an executor run,
  • in C++ using a new interface just for reading
  • in Python, with logic identical to C++ logic

Additionally, we need to get on the same page with populating the graph with parameters

转stnet报错

将stnet训练的模型,想转onnx,但是却报错了
onnx.onnx_cpp2py_export.checker.ValidationError: Nodes in a graph must be topologically sorted, however input 'conv3d_0.tmp_0' of node:
input: "conv3d_0.tmp_0" input: "conv3d_0.tmp_1@reshape_y" output: "conv3d_0.tmp_1" op_type: "Add"
is not output of any previous nodes.

环境:ubuntu 16.04
paddle版本: paddlepaddle-gpu 1.6.1.post107
onnx版本: onnx 1.5.0

Fluid2ONNX conversion on the example

Hello, I met an issue on conversion from fluid to ONNX model on the example. Anyone can help?

----------- Configuration Arguments -----------
fluid_model: extras/fit_a_line.inference.model/
onnx_model: test.onnx
to_print_model: False

Traceback (most recent call last):
File "fluid_to_onnx.py", line 143, in
convert(args)
File "fluid_to_onnx.py", line 67, in convert
var=var, scope=inference_scope)
File "/home/test/paddle-onnx/fluid_onnx/variables.py", line 39, in paddle_onnx_weight
data = _fetch_var(var.name, scope)
File "/home/test/.local/lib/python2.7/site-packages/paddle/fluid/executor.py", line 191, in _fetch_var
assert isinstance(name, str)
AssertionError

ONNX version: 1.2.2+ (pip install on centos 7.2)
Paddle: github Aug 28th

ONNX operators used in image classification models

  • recognize_digits: Conv, Add, Relu, MaxPool, BatchNormalization, Reshape, MatMul, Softmax, Tanh

  • ResNet: Conv, Add, Relu, AveragePool, Reshape, MatMul, Softmax

  • VGG: Conv, Add, Relu, Dropout, Constant, Mul, MaxPool, Reshape, MatMul, BatchNormalization, Softmax

  • MobileNet: Conv, BatchNormalization, Relu, GlobalAveragePool, Reshape, MatMul, Add, Softmax

  • SE_ResNeXt: Conv, BatchNormalization, Relu, MaxPool, GlobalAveragePool, Reshape, MatMul, Add, Sigmoid, Mul, Dropout, Constant, Softmax

  • Inception V4: Conv, BatchNormalization, MaxPool, Concat, AveragePool, Dropout, Constant, Mul, Reshape, MatMul, Add, Softmax

ONNX == 1.0.1, Data layout == NCHW

Undefined shape value in paddle generated onnx model

Paddle-ONNX generated model set dim_value=0 as placeholder for parameters to be set by the user, such as batch size. It seems there is no facility in ONNX to store undefined shape value, such as 0.

The undefined value broke ngraph-onnx importer and this thread is to open a discuss to seek a solution.

There is patch developed by @arogowie-intel which can be submitted to review. That is one the option.

See more info here: #52

CC @kuke @varunarora @postrational @raramer01

转化yolov3 mobilenet backbone 出错。

使用configs/yolov3_mobilenet_v1.yml 配置文件,其中按照自己数据集的相关信息,修改配置文件,训练好的模型采用 paddledetection库中的tools/export_model.py把模型进行导出,而后使用paddle2onnx
准备导出onnx模型,出错信息如下:
使用的相关软件包的版本为:
paddlepaddle-gpu 1.6.1.post107
paddle2onnx 0.2

Screenshot from 2019-12-23 16-39-24-2

Operator unit tests broken

Many unit tests seem to be broken for me on the develop branch.

In particular, the hard-coding of output var type is problematic:

    def append_input_output(self, block, op_proto, np_list, persistable_list, is_input):
        ...
        def create_var(block, name, np_list, var_proto):
            ...
            return block.create_var(
                dtype='float32',
                shape=shape,
                persistable=persistable,
                lod_level=lod_level,
                name=name)

However, making the type from np_val will fix some tests but break many others.

Need develop branch.

New feature or hot-fix should be pushed to develop branch first. The master branch should maintain the stable version. We can polish the conversion for fit_a_line model and when the model is well supported we can ship it to master branch. Please vote for this proposal.

Seems we need add unit test to make sure onnx work properly.

I execute sh setup.sh and all python dependencies are installed successfully. However, I can't run convert.py and the error message is:

Traceback (most recent call last):
  File "convert.py", line 18, in <module>
    from onnx import helper, checker
  File "/usr/local/lib/python2.7/dist-packages/onnx/__init__.py", line 10, in <module>
    import onnx.helper  # noqa
  File "/usr/local/lib/python2.7/dist-packages/onnx/helper.py", line 15, in <module>
    import onnx.defs as defs
  File "/usr/local/lib/python2.7/dist-packages/onnx/defs/__init__.py", line 6, in <module>
    import onnx.onnx_cpp2py_export.defs as C
ImportError: /usr/local/lib/python2.7/dist-packages/onnx/onnx_cpp2py_export.so: undefined symbol: _ZNK6google8protobuf7Message13SpaceUsedLongEv

paddle2onnx ssd_mobilnet_v1

使用paddleDetection的ssd_mobilnet_v1训练获得的模型,使用此工具转换为onnx模型后,使用onnxruntime调用onnx模型检测不到正确的框,概率分数也较低,与真实相差很远。

Need consider compatibility

Please add the following import at the head of each python file.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

We need distinguish persistable vars and const op

Currently, we simply use a Constant operator to handle persistable variables. I think instead we should use
initializes field of onnx graph proto. Since in fluid, we have constant operators, please consider this case:

        cell_init = fluid.layers.fill_constant_batch_size_like(
            input=decoder_boot,
            value=0.0,
            shape=[-1, decoder_size],
            dtype='float32')
        cell_init.stop_gradient = False

        with rnn.block():
            current_word = rnn.step_input(target_embedding)
            encoder_vec = rnn.static_input(encoder_vec)
            encoder_proj = rnn.static_input(encoder_proj)

cell_init should be the constant op which is not trainable.

转yolov3 paddle1.5.1

aistudio@jupyter-83877-140942:~$ paddle2onnx --fluid_model freeze_model/ --onnx_model onnxyolov3.onnx/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
----------- Configuration Arguments -----------
check_task: image_classification
debug: False
fluid_model: freeze_model/
fluid_model_name:
fluid_params_name:
image_path:
name_prefix:
onnx_model: onnxyolov3.onnx
return_variable: False
to_print_model: False

load the model parameter done.
The operator sets to run test case.
{'nearest_interp', 'yolo_box', 'shape', 'batch_norm', 'multiclass_nms', 'conv2d', 'transpose2', 'cast', 'concat', 'fill_constant', 'leaky_relu', 'slice', 'elementwise_mul', 'scale', 'elementwise_add'}
Traceback (most recent call last):
File "/opt/conda/envs/python35-paddle120-env/bin/paddle2onnx", line 10, in
sys.exit(main())
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/fluid_onnx/fluid_to_onnx.py", line 230, in main
convert(args)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/fluid_onnx/fluid_to_onnx.py", line 194, in convert
checker.check_model(onnx_model)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/onnx/checker.py", line 91, in check_model
C.check_model(model.SerializeToString())
onnx.onnx_cpp2py_export.checker.ValidationError: Node () has input size 2 not in range [min=3, max=4].

==> Context: Bad node spec: input: "leaky_relu_58.tmp_0" input: "nearest_interp_0.tmp_0@scales" output: "nearest_interp_0.tmp_0" op_type: "Resize" attribute { name: "mode" s: "nearest" type: STRING }

个别op目前暂不支持

我把ernie的inference model存下来后, 作为paddle-onnx的输入, 然后就报了这样的错:
image
请问有什么解决方案吗? 十分感谢!

转换yolov3报错的问题

使用paddlepaddle1.5版本,下载了model_zoo中的yolov3_darknet_voc,使用PaddlePaddle中PaddleDetection中的infer.py生成__model__和参数文件,再使用paddle2onnx进行转换,碰到了leaky_relu层的输入参数不匹配的问题,可能是什么原因?
image

依赖的环境问题

根据requirements.txt尝试了几种环境组合,依然报错,请问拿release的1.0版本来说,下面的环境是哪个版本啊
protobuf==?
onnx==?
paddlepaddle==?

paddle模型转换为onnx,上线出现错误。

现象:一个最基本的乘法,转换为onnx文件后,上线报错。错误信息:

441188a12e273f99aa4c9c2cf

环境:paddle环境是1.5 ,paddle2onnx 是0.2

paddle部分的代码:

import paddle.fluid.layers as layers
dataX = fluid.layers.data(name="dataX", append_batch_size = False, shape=[2, 5],dtype="float32")
w = layers.create_parameter(shape=[5, 3], dtype='float32', is_bias=False)
output = fluid.layers.mul(dataX, w,
                          x_num_col_dims = 1,
                          y_num_col_dims = 1)

place = fluid.CUDAPlace(0)
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
infer_path = os.path.join('./', 'ckp-infer2')
if not os.path.isdir(infer_path):
    os.makedirs(infer_path)
fluid.io.save_inference_model(main_program=fluid.default_main_program(),
                              dirname=infer_path,
                              feeded_var_names=[dataX.name],
                              target_vars=[output],
                              executor=exe)

然后转换为onnx的命令:

paddle2onnx --fluid_model ckp-infer2/  --onnx_model paddle2onnx_test

看onnx文件,发现里面确实有一个reshape的操作。不清楚为什么
image

FileNotFoundError: [Errno 2] No such file or directory: '/home/work/******params/__model__'

----------- Configuration Arguments -----------
check_task: image_classification
debug: False
fluid_model: /home/work/luqiankun/tools_for_renfeng/qt_batchlist_31w_bak/params/
fluid_model_name:
fluid_params_name:
image_path:
name_prefix:
onnx_model: ERNIE2.0
return_variable: False
to_print_model: False

Traceback (most recent call last):
File "/ssd1/share/python36/bin/paddle2onnx", line 11, in
load_entry_point('paddle2onnx==0.1', 'console_scripts', 'paddle2onnx')()
File "/ssd1/share/python36/lib/python3.6/site-packages/paddle2onnx-0.1-py3.6.egg/fluid_onnx/fluid_to_onnx.py", line 230, in main
File "/ssd1/share/python36/lib/python3.6/site-packages/paddle2onnx-0.1-py3.6.egg/fluid_onnx/fluid_to_onnx.py", line 99, in convert
File "/ssd1/share/python36/lib/python3.6/site-packages/paddle/fluid/io.py", line 1199, in load_inference_model
with open(model_filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/work/******/params/model'

运行代码报错 __model__文件是什么?我再paddle里下的ernie模型里也没有这个文件呀

import paddle.fluid as fluid ImportError: No module named fluid

Using pip install paddlepaddle, I get the paddlepaddle (0.11.0).
After that I tried python convert.py --modeldir inception_v1/, I get the error: import paddle.fluid as fluid ImportError: No module named fluid.

Then I tried to change import paddle.v2.fluid as fluid, it works.

Rerunning the converter and get the following error:

  File "/home/haifeng/Synopsys/paddle-onnx/convert.py", line 21, in <module>
    import fluid_onnx.ops as ops
  File "/home/haifeng/Synopsys/paddle-onnx/fluid_onnx/ops.py", line 17, in <module>
    from paddle.fluid.executor import fetch_var
ImportError: No module named fluid.executor

It seems the converter use different paddlepaddle version.
Could you look into it?

Thanks

fluid_to_onnx show error

i don't know what happens and how to solve it

-----------  Configuration Arguments -----------
check_task: image_classification
debug: False
fluid_model: ../mask_detector/
fluid_model_name: __model__
fluid_params_name: __param__
image_path: 
name_prefix: 
onnx_model: ./model.onnx
return_variable: False
to_print_model: False
------------------------------------------------
load the model parameter done.
Traceback (most recent call last):
  File "fluid_to_onnx.py", line 234, in <module>
    main()
  File "fluid_to_onnx.py", line 230, in main
    convert(args)
  File "fluid_to_onnx.py", line 141, in convert
    block=block)
  File "/home/tu/anaconda3/envs/occlusion_face_paddle/lib/python3.7/site-packages/fluid_onnx/ops.py", line 192, in conv2d_op
    kernel_shape = block.vars[get_old_name(inputs['Filter'][0])].shape
KeyError: ''

Issues using paddle onnx convert models

We ran into the following issues and would like to get direction from paddle-onnx dev.

1. assertion error : dims.nbDims == 3

I can convert paddle paddle models to onnx using the fluid_to_onnx.py script, e.g.

(venv) root@c33e4b787188:/paddle-onnx# python fluid_to_onnx.py --fluid_model extras/fit_a_line.inference.model --onnx_model extras/fit_a_line.onnx.inference.model --to_print_model > extras/fit_a_line_onnx.inference.model.out
(venv) root@c33e4b787188:
/paddle-onnx# cd extras
(venv) root@c33e4b787188:~/paddle-onnx/extras# ls
fit_a_line.inference.model fit_a_line.onnx.inference.model fit_a_line_onnx.inference.model.out

but when I try to validate the resulting onnx model using the validate.py script I get the following error when using the tensorrt backend:

(venv) root@c33e4b787188:/paddle-onnx# deactivate
root@c33e4b787188:
/paddle-onnx# python validate.py --fluid_model extras/fit_a_line.inference.model --onnx_model extras/fit_a_line.onnx.inference.model --backend tensorrt
----------- Configuration Arguments -----------
a: 0.0
b: 1.0
backend: tensorrt
batch_size: 10
expected_decimal: 5
fluid_model: extras/fit_a_line.inference.model
onnx_model: extras/fit_a_line.onnx.inference.model

Inference results for fluid model:
[array([[15.874767],
[17.174097],
[14.951813],
[14.069194],
[13.003316],
[17.782452],
[16.204231],
[13.260891],
[15.537827],
[13.720056]], dtype=float32)]

Traceback (most recent call last):
File "validate.py", line 129, in
validate(args)
File "validate.py", line 113, in validate
rep = backend.prepare(onnx_model, device='CUDA:0')
File "build/bdist.linux-x86_64/egg/onnx_tensorrt/backend.py", line 166, in prepare
File "build/bdist.linux-x86_64/egg/onnx_tensorrt/backend.py", line 71, in init
RuntimeError: While parsing node number 1:
/root/onnx-tensorrt/builtin_op_importers.cpp:539 In function importFlatten:
[8] Assertion failed: dims.nbDims == 3

2. Issue 2 : dim_value 0

We see some dim_value of 0 in the generated model. Is this expected and how those should be interpreted.

When I look at the human readable onnx model, i.e. fit_a_line_onnx.inference.model.out that was generated by the fluid_to_onnx.py script there are nodes with dim_value of 0:

(venv) root@c33e4b787188:~/paddle-onnx/extras# cat fit_a_line_onnx.inference.model.out | more

----------- Configuration Arguments -----------
fluid_model: extras/fit_a_line.inference.model
onnx_model: extras/fit_a_line.onnx.inference.model
to_print_model: True

The converted model is:
ir_version: 3
producer_name: "PaddlePaddle"
graph {
node {
input: "x"
output: "x@flatten_0"
op_type: "Flatten"
attribute {
name: "axis"
i: 1
type: INT
}
}
node {
input: "fc_0.w_0"
output: "fc_0.w_0@flatten_0"
op_type: "Flatten"
attribute {
name: "axis"
i: 1
type: INT
}
}
node {
input: "x@flatten_0"
input: "fc_0.w_0@flatten_0"
output: "fc_0.tmp_0@matmul_0"
op_type: "MatMul"
}
node {
output: "fc_0.tmp_0@shape_0"
op_type: "Constant"
attribute {
name: "value"
t {
dims: 2
data_type: INT64
int64_data: 0
int64_data: 1
name: fc_0.tmp_0@shape_0
}
type: TENSOR
}
}
node {
input: "fc_0.tmp_0@matmul_0"
input: "fc_0.tmp_0@shape_0"
output: "fc_0.tmp_0"
op_type: "Reshape"
}
node {
input: "fc_0.tmp_0"
input: "fc_0.b_0"
output: "fc_0.tmp_1"
op_type: "Add"
attribute {
name: "axis"
i: 1
type: INT
}
attribute {
name: "broadcast"
i: 1
type: INT
}
}
name: "fit_a_line"
initializer {
dims: 1
data_type: FLOAT
float_data: 19.3055801392
name: "fc_0.b_0"
}
initializer {
dims: 13
dims: 1
data_type: FLOAT
float_data: -0.235716566443
float_data: 1.50793659687
float_data: -1.37839913368
float_data: 0.587660908699
float_data: -1.62691628933
float_data: 1.94002008438
float_data: -1.5584435463
float_data: 1.01809895039
float_data: -2.47688126564
float_data: -2.48663592339
float_data: -2.72155380249
float_data: 1.01887917519
float_data: -2.73560881615
name: "fc_0.w_0"
}
input {
name: "x"
type {
tensor_type {
elem_type: FLOAT
shape {
dim {
dim_value: 0
}
dim {
dim_value: 13
}
}
}
}
}
input {
name: "fc_0.b_0"
type {
tensor_type {
elem_type: FLOAT
shape {
dim {
dim_value: 1
}
}
}
}
}
input {
name: "fc_0.w_0"
type {
tensor_type {
elem_type: FLOAT
shape {
dim {
dim_value: 13
}
dim {
dim_value: 1
}
}
}
}
}
output {
name: "fc_0.tmp_1"
type {
tensor_type {
elem_type: FLOAT
shape {
dim {
dim_value: 0
}
dim {
dim_value: 1
}
}
}
}
}
}
opset_import {
version: 7
}

Saved converted model to path: extras/fit_a_line.onnx.inference.model

I get the same results after converting the recognize_digits_mlp.inference.model from the paddle paddle repo’s /path-to-repo/paddle-paddle/python/paddle/fluid/tests/book directory…

Some important feedforward models to be supported at first stage

We are going to support the conversion of models as follows at first stage. They all can be found in our models bank, some maybe only need to be verified after #19 merged, and some lack of necessary operators.

Even all the models above are supported, only a small subset of operators are used and verified. So for the rest operators, we may need another task:

  • Design the unit test framework to test every operator's conversion (#29 @kuke)

Hints:

  • Choose one task every time and assign yourself when you are really ready for working on it;
  • Please append the model to the supported models section in README like #19 after its conversion being validated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.