-
Notifications
You must be signed in to change notification settings - Fork 486
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
Fix encoder-decoder ONNX merge #924
Conversation
The documentation is not available anymore as the PR was closed or merged. |
outputs_only_in_1 = model1_outputs - model2_outputs | ||
outputs_only_in_2 = model2_outputs - model1_outputs | ||
if len(outputs_only_in_2) > 0: | ||
raise ValueError("The ModelProto model2 should not have more outputs than model1.") |
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.
raise ValueError("The ModelProto model2 should not have more outputs than model1.") | |
raise ValueError("The 2nd ModelProto should not have more outputs than 1st 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.
And btw why can model 1 have more outputs than model2 but not inverse?
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.
merge_decoders
is asymmetrical for now - it was before as well as we use the outputs of model1. It's indeed not good and can be changed in an other PR.
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.
LGTM!
|
||
outputs_only_in_1 = model1_outputs - model2_outputs | ||
outputs_only_in_2 = model2_outputs - model1_outputs | ||
if len(outputs_only_in_2) > 0: |
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.
Is the raw number of element check enough?
Because we could check if one is a subset of the other as well if needed?
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.
Thanks, fixed with set checks!
else: | ||
model2.graph.output.remove(model_output_2) | ||
|
||
# We use model1 (normally the decoder) for the output shape |
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.
<3
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.
<3
Co-authored-by: Michael Benayoun <[email protected]>
Co-authored-by: Michael Benayoun <[email protected]>
Co-authored-by: Michael Benayoun <[email protected]>
…ptimum into fix-decoder-merge-onnx
Fixes #921
In next PRs:
optimum-cli export onnx