-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add onnxsim to peephole optimizer #1602
Conversation
@@ -120,7 +120,7 @@ | |||
"supported_providers": [ "*" ], | |||
"supported_accelerators": [ "*" ], | |||
"supported_precisions": [ "*" ], | |||
"extra_dependencies": [ "onnxoptimizer", "onnxscript" ] | |||
"extra_dependencies": [ "onnxoptimizer", "onnxscript", "onnxsmi" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
return | ||
|
||
self.model, check = simplify(self.model) | ||
if not check: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the source code, check is a Boolean whether the outputs of the original and simplified model match. So the message doesn't count correct.
Since it uses the default value of 0 for check_n, this is probably always be True.
@@ -265,6 +276,7 @@ def _run_for_config( | |||
|
|||
# optimize model | |||
peephole_optimizer = ModelOptimizer(model.model_path) | |||
peephole_optimizer.onnxsimplifier_optimize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be better to move it after onnxscript. I don't think onnx simplifier handles dynamo exported model? If so, it's safer to put it after onnxscript.
@@ -28,8 +28,8 @@ onnx-graphsurgeon | |||
onnxconverter_common | |||
onnxmltools | |||
onnxoptimizer | |||
onnxsim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alphabetical order
# setup | ||
input_model = get_onnx_model() | ||
p = create_pass_from_dict(OnnxPeepholeOptimizer, {}, disable_search=True) | ||
mock_onnxsim.return_value = input_model.load_model() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expects a tuple of model and Boolean
Closing as will add implementation ourselves. |
Describe your changes
Add onnxsim to peephole optimizer.
Checklist before requesting a review
lintrunner -a
(Optional) Issue link