-
Notifications
You must be signed in to change notification settings - Fork 1k
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
adjust overriding of model's forward function #1492
adjust overriding of model's forward function #1492
Conversation
The documentation is not available anymore as the PR was closed or merged. |
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 but would love to have @muellerzr have a look as well.
Edit: looks like this breaks in mixed precision settings.
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.
The solution/idea presented here makes sense, but let's make sure tests pass before we can merge please :) (And then I'll give the ✅ 😉 )
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 for this! Great work! Let's do a quick make style; make quality
to ensure that the quality tests pass, then we're good to merge :)
During ONNX Runtime optimization, the forward function's signature is inspected to perform downstream tasks. The current way of overriding the model's forward function results in the following error:
AttributeError: 'function' object has no attribute '__func__'
This PR improves the function signature override by using
types.MethodType
which doesn't impact the function signature for downstream tasks.