-
Notifications
You must be signed in to change notification settings - Fork 328
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
[Feature] Add OptimizerHook #716
Conversation
@vmoens As currently implemented, the new hook's signature is different from other hooks: besides accepting (and returning) a If we want the optimizer hook to be more similar to other hooks, we could:
Importantly, even after the above modifications, Please let me know how you'd like to proceed. Thanks! |
Codecov Report
@@ Coverage Diff @@
## main #716 +/- ##
==========================================
+ Coverage 88.77% 88.89% +0.12%
==========================================
Files 122 122
Lines 21151 21273 +122
==========================================
+ Hits 18776 18910 +134
+ Misses 2375 2363 -12
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Great stuff!
Thanks a lot for this!
Regarding this
It's ok, it's backward compatible and it suits most needs. |
Description
The new type of hook,
OptimizerHook
, is added as suggested in #704.Motivation and Context
See the suggested change in #704.
Types of changes
What types of changes does your code introduce? Remove all that do not apply:
Backward compatibility with the existing
optimizer
parameter ofTrainer.__init__
is respected.Minor breaking change: previously
grad_norm
key in thelosses_td
is nowgrad_norm_0
.Checklist
Go over all the following points, and put an
x
in all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!
The change made in the documentation is very initial:
optimizer
hook is just briefly mentioned in the list of possible hooks and theOptimizerHook
class is added to the "Trainer and hooks" table. Probably, wider documentation coverage of the new hook type is needed.cc @BY571