LightGlue-ONNX: error when using TensorrtExecutionProvider for ONNX models

Hi, I have another issue. I first optimized only the matcher (lightglue.onnx), and then run the infer with --trt, but got the following error. When I exported the models to ONNX, I didn’t use --dynamic [E:onnxruntime:, inference_session.cc:1785 operator()] Exception during initialization: /onnxruntime_src/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc:1552 SubGraphCollection_t onnxruntime::TensorrtExecutionProvider::GetSupportedList(SubGraphCollection_t, int, int, const onnxruntime::GraphViewer&, bool*) const [ONNXRuntimeError] : 1 : FAIL : TensorRT input: /NonZero_output_0 has no shape specified. Please run shape inference on the onnx model first. Details can be found in https://onnxruntime.ai/docs/execution-providers/TensorRT-ExecutionProvider.html#shape-inference-for-tensorrt-subgraphs

Do you have any ideas about this? Thank you in advance.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

@dashirenyu You need to run symbolic_shape_infer.py to convert the onnx model to trt version. Check the link you just posted.

You’re welcome, @noahzn. Happy I could help.

I guess the closest thing would be PyTorch’s tutorials in their docs, but in my experience most tutorials assume that the model to be converted can be converted. The process of adapting a model so that it can be converted is rarely easy and usually requires customization.