Repository navigation
Fix fp16 ONNX export API + document RoiAlign TensorRT limitation - #13
Merged
Merged
Conversation
added 2 commits
May 31, 2026 15:33
exporter._convert_fp16 called float16.convert_float_to_fp16, which doesn't exist in onnxconverter-common; use convert_float_to_float16(..., keep_io_types=True) so the I/O stays float32 for the Deploy runtime's preprocessing. docs/TensorRT.md: add a 'Known limitation' note that two-stage detectors (Faster/Mask R-CNN) fail TensorRT engine builds at the RoiAlign op (plugin not in registry), plus a troubleshooting entry. CHANGELOG updated.
onnxconverter-common's float16 pass produces an invalid graph for Detectron2 models (type-mismatched Cast nodes onnxruntime rejects), and it had already overwritten model.onnx before validation caught it. _convert_fp16 now converts to a temp file, verifies it loads, and only replaces the model if valid — otherwise it keeps the fp32 model and logs a warning. validate_onnx is also non-fatal so a post-write check can't fail a completed export.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed
fp16 ONNX export crashed:
The exporter called a non-existent function. Corrected to
convert_float_to_float16(..., keep_io_types=True)— the real API in onnxconverter-common, andkeep_io_types=Truekeeps the model's input/output float32 so the Deploy runtime's float32 preprocessing still matches.Documented
docs/TensorRT.mdgets a "Known limitation" note: two-stage detectors (Faster/Mask R-CNN) fail the TensorRT engine build at theRoiAlignop because TensorRT maps it to a plugin that isn't registered by default (ROIAlign plugin was not found in the plugin registry), and the exporter doesn't supply it. Plus a matching troubleshooting entry. (Discovered while attempting a real engine build on the user's model.)Docs + a one-line code fix.
ruffclean; exporter tests pass (the fp16 path needs onnx/onnxconverter-common which CI doesn't install, so it's covered by the corrected API name + manual verification against onnxconverter-common 1.16.0).