Skip to content

Commit

Permalink
[dynamo exporter] Add optimize to onnx conversion config (#1622)
Browse files Browse the repository at this point in the history
## Describe your changes

## Checklist before requesting a review
- [ ] Add unit tests for this change.
- [ ] Make sure all tests can pass.
- [ ] Update documents if necessary.
- [ ] Lint and apply fixes to your code by running `lintrunner -a`
- [ ] 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
titaiwangms authored Feb 18, 2025
1 parent 5a616d8 commit ba99f86
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions olive/passes/onnx/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ def _default_config(cls, accelerator_spec: AcceleratorSpec) -> Dict[str, PassCon
"Includes config.json, generation_config.json, and tokenizer related files."
),
),
"optimize": PassConfigParam(
type_=bool,
default_value=True,
description=("Whether to export the model with constant folding and redundancies elimination."),
),
"dynamic": PassConfigParam(
type_=bool, default_value=True, description=("Whether to export the model with dynamic axes/shapes.")
),
Expand Down Expand Up @@ -263,6 +268,7 @@ def _export_pytorch_model(
dynamic_shapes=io_config.dynamic_shapes,
dynamo=True,
fallback=True,
optimize=config.optimize,
report=logger.isEnabledFor(logging.DEBUG),
)
assert onnx_program is not None
Expand Down

0 comments on commit ba99f86

Please sign in to comment.