-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dynamo exporter] Support string in dynamic_shapes (#1639)
## Describe your changes With pytorch/pytorch#146321, `torch.onnx.export(.., dynamo=True)` now can support string in dynamic_shapes, which fits better with Olive driven with configuration. Major changes: - Add support for string in dynamic_shapes - Move dynamic_shapes pre-process to io_config.py (like dynamic_axes) - Get rid of the post-process of making [str, int, int] -> torch.export.Dim(str, max=int, min=int). `torch.onn.export(..., dynamo=True)` can now take string. - Leverage Optimum to auto-generate dynamic_shapes when Optimum models is requested. - KV cache support Pitfall: - When dynamic_shapes targets kwargs, both of them need to follow the order of model.forward signature. onnx/conversion.py provides naive approach to sort them, but users should be aware of this. Minor changes: - Move onnxscript (released) to the official requirement.txt - dynamic_shapes with string is supported since torch 2.7 ## Checklist before requesting a review - [x] Add unit tests for this change. - [ ] Make sure all tests can pass. - [ ] Update documents if necessary. - [x] Lint and apply fixes to your code by running `lintrunner -a` - [x] Is this a user-facing change? If yes, give a description of this change to be included in the release notes. - [ ] Is this PR including examples changes? If yes, please remember to update [example documentation](https://github.com/microsoft/Olive/blob/main/docs/source/examples.md) in a follow-up PR. ## (Optional) Issue link
- Loading branch information
1 parent
51d2c8a
commit ba7e187
Showing
12 changed files
with
235 additions
and
140 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.