I convert a pytorch model to onnx model successfully, but when I try to convert this model to trt, an error occours:
[TensorRT] WARNING: onnx2trt_utils.cpp:220: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped Traceback (most recent call last): File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/yckj3858/.vscode-server/extensions/ms-python.python-2020.9.111407/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module> cli.main() File "/home/yckj3858/.vscode-server/extensions/ms-python.python-2020.9.111407/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 430, in main run() File "/home/yckj3858/.vscode-server/extensions/ms-python.python-2020.9.111407/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 267, in run_file runpy.run_path(options.target, run_name=compat.force_str("__main__")) File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/yckj3858/mmdetection/tools/onnx_trt.py", line 138, in <module> engine = backend.prepare(onnx_model) File "/home/yckj3858/onnx-tensorrt/onnx_tensorrt/backend.py", line 200, in prepare return TensorRTBackendRep(model, device, **kwargs) File "/home/yckj3858/onnx-tensorrt/onnx_tensorrt/backend.py", line 86, in __init__ raise RuntimeError(msg) RuntimeError: While parsing node number -1: builtin_op_importers.cpp:385 In function importConcat: [8] Assertion failed: !input.isBool()
Does anyone know how to solve it? The print confuse me: there is not a node number -1 and the input cannot be bool type. I only run the code:
import onnx_tensorrt.backend as backend onnx_model = onnx.load('tmp3.onnx') engine = backend.prepare(onnx_model)
And the error occour, tmp3.onnx is my onnx model. Hope your reply!
I convert a pytorch model to onnx model successfully, but when I try to convert this model to trt, an error occours:
[TensorRT] WARNING: onnx2trt_utils.cpp:220: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped [TensorRT] WARNING: onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped Traceback (most recent call last): File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/yckj3858/.vscode-server/extensions/ms-python.python-2020.9.111407/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module> cli.main() File "/home/yckj3858/.vscode-server/extensions/ms-python.python-2020.9.111407/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 430, in main run() File "/home/yckj3858/.vscode-server/extensions/ms-python.python-2020.9.111407/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 267, in run_file runpy.run_path(options.target, run_name=compat.force_str("__main__")) File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/home/yckj3858/anaconda3/envs/pytorch/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/yckj3858/mmdetection/tools/onnx_trt.py", line 138, in <module> engine = backend.prepare(onnx_model) File "/home/yckj3858/onnx-tensorrt/onnx_tensorrt/backend.py", line 200, in prepare return TensorRTBackendRep(model, device, **kwargs) File "/home/yckj3858/onnx-tensorrt/onnx_tensorrt/backend.py", line 86, in __init__ raise RuntimeError(msg) RuntimeError: While parsing node number -1: builtin_op_importers.cpp:385 In function importConcat: [8] Assertion failed: !input.isBool()Does anyone know how to solve it? The print confuse me: there is not a node number -1 and the input cannot be bool type. I only run the code:
import onnx_tensorrt.backend as backend onnx_model = onnx.load('tmp3.onnx') engine = backend.prepare(onnx_model)And the error occour, tmp3.onnx is my onnx model. Hope your reply!