[Question]: Export .pt to .onnx with fp16 was removed
Closed this issue · 4 comments
Hello
I am only starting learning technology, trying to understand why half precision was removed from export and replaced with dynamic shape? They can work together or not?
After practical testing, currently only YOLOv5 does not support exporting both half precision and dynamic shape simultaneously. Refer to ultralytics/yolov5#11683 for more details.
The decision to deprecate the export of half precision in ONNX is because ONNX is commonly used as an intermediate representation for model migration. By providing more options when converting to other formats such as TensorRT, it allows for greater flexibility.
Thank you for quick answer, but how I understood if onnx not in fp16 then converting to tensorrt model with
/usr/src/tensorrt/bin/trtexec --onnx=... --saveEngine=... --fp16
will not work ( output will be as fp32 ) right?
When exporting an ONNX model in FP32, you can use the --fp16
option with trtexec
to convert the precision to FP16 during the export of the TensorRT engine (default is FP32). However, when exporting an ONNX model in FP16, it is necessary to include the --fp16
option. For more guidance on using trtexec
, please refer to https://github.com/NVIDIA/TensorRT/tree/main/samples/trtexec.
Understand, thank you