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.
This PR introduces ONNX export functionality using TorchDynamo with the following enhancements:
Custom Ops Registration
Added fake registration for custom operators to enable successful graph tracing during export.
Dynamic Axes → Dynamic Shapes Conversion
Implemented logic to convert dynamic axes specifications into dynamic shape handling for ONNX export.
Caching Utilities Integration
Updated cache utilities to support ONNX export workflows.
Causal LM Models
Verified that causal language models now successfully export and compile using the new pipeline. The generated onnx file gives correct output on onnxruntime.
Vision-Language Models (VLM)
Added get_onnx_dynamic_shapes() function across 5 VLM modeling files to handle dynamic shape inference.
Note: VLM models currently export successfully but fail during compilation (work in progress).
Dependencies
Tested with:
PyTorch: 2.9.1
Transformers: 4.55
Latest ONNX, onnxscript, and onnxruntime libraries.