Repository navigation
Exporters: OnnxConfig(ort_ep=...) names the ONNX Runtime execution provider, adds TensorRT - #50643
Closed
IlyasMoutawwakil wants to merge 5 commits into
Closed
IlyasMoutawwakil wants to merge 5 commits into
IlyasMoutawwakil wants to merge 5 commits into
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. Pages changed in this PR: |
Contributor
There was a problem hiding this comment.
Model linter — first pass
transformers-mlinter found 1 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.
This is automated and advisory — it does not block merging.
| rule | count | what it checks |
|---|---|---|
TRF057 |
1 | Public model, config, output and processor classes and their public methods must carry @auto_docstring. |
1 item(s) outside this diff
src/transformers/models/molmo2/modular_molmo2.py:1581TRF057 — TRF057:Molmo2Model.get_video_featuresin modeling_molmo2.py has no @auto_docstring. No parent method it could inherit the decorator from declares it. Add @auto_docstring as the innermost decorator here.
IlyasMoutawwakil
marked this pull request as ready for review
November 16, 2026 07:43
Contributor
There was a problem hiding this comment.
Model linter — first pass
transformers-mlinter found 3 item(s) in the model files this PR touches. These are structural conventions a maintainer would otherwise flag by hand.
This is automated and advisory — it does not block merging.
| rule | count | what it checks |
|---|---|---|
TRF057 |
3 | Public model, config, output and processor classes and their public methods must carry @auto_docstring. |
3 item(s) outside this diff
src/transformers/models/hy_v4_vl/modular_hy_v4_vl.py:514TRF057 — TRF057:HYV4VLModel.get_image_featuresin modeling_hy_v4_vl.py has no @auto_docstring. Declaring @can_return_tuple here drops every decorator of the parent method. Add @auto_docstring as the innermost decorator here.src/transformers/models/hy_v4_vl/modular_hy_v4_vl.py:538TRF057 — TRF057:HYV4VLModel.get_video_featuresin modeling_hy_v4_vl.py has no @auto_docstring. Declaring @can_return_tuple here drops every decorator of the parent method. Add @auto_docstring as the innermost decorator here.src/transformers/models/moss_transcribe_diarize/modular_moss_transcribe_diarize.py:779TRF057 — TRF057:MossTranscribeDiarizeForConditionalGeneration.get_audio_featuresin modeling_moss_transcribe_diarize.py has no @auto_docstring. No parent method it could inherit the decorator from declares it. Add @auto_docstring as the innermost decorator here.
ModelOptOnnxQuantizer quantizes the converted ONNX graph for TensorRT, OnnxConfig(for_tensorrt=True) keeps the attention mask boolean at opset 22, and the ONNX runner hands TensorRT an ONNX Runtime calibration table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IlyasMoutawwakil
force-pushed
the
exporters-modelopt-quantizer
branch
from
November 22, 2026 20:26
4b07912 to
306ee58
Compare
IlyasMoutawwakil
added a commit
that referenced
this pull request
Nov 22, 2026
#50643) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and the TensorRT calibration table Neither beat bf16 TensorRT at acceptable accuracy. Without the main-fixes opset default of 23, for_tensorrt needs no opset of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OnnxConfig(for_tensorrt=True) keeps the attention mask boolean for TensorRT
…tead of an inline conditional apply_patches takes several patch sets: ONNX exports apply onnx plus onnx.default, or onnx.tensorrt for ONNX Runtime's TensorRT execution provider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ovider, ort_fusions deprecated ort_ep takes cpu / cuda / webgpu / dml (fuse for that provider) or tensorrt (no fusions, boolean attention mask), replacing ort_fusions and for_tensorrt. ort_fusions still works, with a deprecation warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OnnxConfig(for_tensorrt=True) keeps the attention mask boolean for TensorRTOnnxConfig(ort_ep=...) names the ONNX Runtime execution provider, adds TensorRT
TensorRT showed no speedup with either SDPA mask variant on generation (SmolLM2-360M, A100). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds
OnnxConfig(ort_ep=...): the ONNX Runtime execution provider the export will run on. It replacesort_fusions(still accepted, with a deprecation warning) and adds TensorRT.ort_epNoneonnx,onnx.default"cpu","cuda","webgpu","dml"onnx,onnx.default"tensorrt"onnx,onnx.tensorrtTensorRT builds a faster engine from the boolean mask: EmbeddingGemma2 (
google/embeddinggemma-2, bf16, 8 sentences × 128 tokens, static shapes, CUDA graphs) on a B200 goes from 3.00 ms to 2.53 ms, 7.3x eager instead of 5.5x, with the same accuracy.Every other export keeps the additive mask, as on
main: torchlib's boolean softmax guards each attention with anIsNaN/Where, which ONNX Runtime's own kernels pay for (2x on a 2520-patch vision attention on its CPU provider). The boolean-to-additive conversion moves out of_patch_sdpainto its own patch,_additive_sdpa_mask, registered under a newonnx.defaultpatch set.apply_patchestakes several patch sets: ONNX exports applyonnxplusonnx.default, oronnx.tensorrt(empty for now) for the TensorRT provider.B200, driver 580.126.20; torch 2.13.0+cu130, onnxruntime-gpu 1.29.0 (CUDA 13), TensorRT 10.16.1.11. Latency is the median over ≥300 calls and 10 s.
Dropped from this PR
This PR also added a ModelOpt ONNX quantizer and an ONNX Runtime calibration table for TensorRT's implicit int8. Neither beat plain bf16 TensorRT at acceptable accuracy, so both are removed:
generate(69% of eager's tokens). On a B200, no recipe beat bf16 at cosine ≥ 0.999.Tests
tests/exporters/test_fusions.py::test_tensorrt_keeps_the_boolean_mask:ort_ep="tensorrt"keeps theIsNaNguard and adds nocom.microsoftops, the default export has noIsNaN, and both match.test_ort_fusions_is_the_deprecated_ort_ep:ort_fusionsmaps toort_ep, and passing both raises.🤖 Generated with Claude Code
🤖 mlinter review state
bccbae7ee3553f99OnnxConfig(ort_ep=...)names the ONNX Runtime execution provider, adds TensorRT #50643 (review)