[Pytorch] Dynamo ONNX export support #1497
Draft
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.
Description
This PR adds torch onnx dynamo-based export support. This draft is published to discuss the direction of the progress, it is not functional yet.
Current idea:
onnx_forward
in modules, which is much simpler version of forward, which will be run in onnx_export mode. Idea: it was hard to make dynamo work with original layers and inference flow is much much simpler, so this is not painful,te_translation_table
, which need to be passed totorch.onnx.export(dynamo=True, custom_translation_table=te_translation_table)
.torch.onnx.export(dynamo=True)
seem to be working for some modules,torch.onnx.dynamo_export
will not work, because it has unsupported features like generators, which are essential part of the TE layers,Type of change
Checklist: