Paddle2ONNX icon indicating copy to clipboard operation
Paddle2ONNX copied to clipboard

fake_quantize_range_abs_max算子不支持

Open hcms1994 opened this issue 3 years ago • 10 comments

onnx模型转paddle模型,使用paddleslim可以完成离线量化,但离线量化后的paddle模型再转onnx模型存在op不支持问题 报错信息: /usr/local/lib/python3.9/site-packages/onnx/mapping.py:27: DeprecationWarning: np.object is a deprecated alias for the builtin object. To silence this warning, use object by itself. Doing this will not modify any behavior and is safe. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations int(TensorProto.STRING): np.dtype(np.object) /usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/constant/dtypes.py:49: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations /usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/constant/dtypes.py:50: DeprecationWarning: np.float is a deprecated alias for the builtin float. To silence this warning, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations /usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/constant/dtypes.py:55: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations Traceback (most recent call last): File "/usr/local/bin/paddle2onnx", line 33, in sys.exit(load_entry_point('paddle2onnx==0.9.0', 'console_scripts', 'paddle2onnx')()) File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/command.py", line 187, in main File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/command.py", line 151, in program2onnx File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/convert.py", line 87, in program2onnx File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/convert.py", line 34, in export_onnx File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/graph/onnx_graph.py", line 379, in build File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/graph/onnx_graph.py", line 90, in init File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/graph/onnx_graph.py", line 326, in update_opset_version File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/op_mapper/op_mapper.py", line 128, in get_recommend_opset_version File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/op_mapper/op_mapper.py", line 174, in check_support_status NotImplementedError: There's 1 ops are not supported yet =========== fake_quantize_range_abs_max ===========

hcms1994 avatar Feb 11 '22 08:02 hcms1994

请拉这个PR进行测试:https://github.com/PaddlePaddle/Paddle2ONNX/pull/399

yeliang2258 avatar Feb 12 '22 14:02 yeliang2258

请拉这个PR进行测试:#399

fake_quantize_range_abs_max这个算子还是没有支持,没看到这个PR支持fake_quantize_range_abs_max,麻烦帮忙再看下

hcms1994 avatar Feb 14 '22 02:02 hcms1994

好的,收到反馈,我们会尽快支持。

yeliang2258 avatar Feb 14 '22 03:02 yeliang2258

请问一下,你是什么使用使用场景啊?导出为ONNX模型的原因是?

yeliang2258 avatar Feb 16 '22 12:02 yeliang2258

请问一下,你是什么使用使用场景啊?导出为ONNX模型的原因是?

idg的项目中需要,lidar 3D点云检测,原模型是pytorch训练的,然后量化后误差较大,现在尝试转成paddle模型,用paddleslim的离线量化方式,目前存在fake_quantize_range_abs_max不支持,辛苦尽快支持下!

hcms1994 avatar Feb 17 '22 13:02 hcms1994

您好,麻烦再试一下这个PR:https://github.com/PaddlePaddle/Paddle2ONNX/pull/399

yeliang2258 avatar Feb 21 '22 09:02 yeliang2258

这个PR是否已经解决了 这个问题? There's 2 ops are not supported yet =========== fake_channel_wise_quantize_dequantize_abs_max =========== =========== fake_quantize_dequantize_moving_average_abs_max ===========

ztfmars avatar Feb 22 '22 08:02 ztfmars

这个PR是否已经解决了 这个问题? There's 2 ops are not supported yet =========== fake_channel_wise_quantize_dequantize_abs_max =========== =========== fake_quantize_dequantize_moving_average_abs_max ===========

/usr/local/lib/python3.9/site-packages/onnx/mapping.py:27: DeprecationWarning: np.object is a deprecated alias for the builtin object. To silence this warning, use object by itself. Doing this will not modify any behavior and is safe. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations int(TensorProto.STRING): np.dtype(np.object) /usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/constant/dtypes.py:49: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations /usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/constant/dtypes.py:50: DeprecationWarning: np.float is a deprecated alias for the builtin float. To silence this warning, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations /usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/constant/dtypes.py:55: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations 2022-02-22 16:47:44 [WARNING] There are 2 ops that are not supported in opset version 9, please set opset version >= 13. =========== fake_channel_wise_dequantize_max_abs =========== =========== fake_quantize_range_abs_max ===========

2022-02-22 16:47:44 [WARNING]

For a successful conversion, set the recommended opset version : 13

======================

/usr/local/lib/python3.9/site-packages/onnx/helper.py:343: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working is_iterable = isinstance(value, collections.Iterable) 2022-02-22 16:47:45 [INFO] ONNX model generated is valid. Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/utils.py", line 43, in check_model File "/usr/local/lib/python3.9/site-packages/onnx/checker.py", line 104, in check_model C.check_model(protobuf_string) onnx.onnx_cpp2py_export.checker.ValidationError: Nodes in a graph must be topologically sorted, however input 'relu_3.tmp_0.quantized_0.paddleadd0' of node: name: ConvTranspose_0 OpType: ConvTranspose is not output of any previous nodes.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/paddle2onnx", line 33, in sys.exit(load_entry_point('paddle2onnx==0.9.0', 'console_scripts', 'paddle2onnx')()) File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/command.py", line 187, in main File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/command.py", line 151, in program2onnx File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/convert.py", line 87, in program2onnx File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/convert.py", line 40, in export_onnx File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/graph/onnx_graph.py", line 369, in export_proto File "/usr/local/lib/python3.9/site-packages/paddle2onnx-0.9.0-py3.9.egg/paddle2onnx/utils.py", line 45, in check_model Exception: ONNX model is not valid.

拉取PR后报以上错误,opset我更新到1.3了,麻烦看下还是什么原因?

hcms1994 avatar Feb 22 '22 08:02 hcms1994

您好,麻烦再试一下这个PR:#399

又报了新的错误,麻烦帮忙看下

hcms1994 avatar Feb 22 '22 09:02 hcms1994

您好,麻烦提供一下模型,我这边具体来测试一下。

yeliang2258 avatar Feb 23 '22 02:02 yeliang2258