-
-
Notifications
You must be signed in to change notification settings - Fork 617
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
Fixed EMAHandler warm-up behaviour #2333
Conversation
Signed-off-by: sandylaker <yawei.li@tum.de>
Thanks for the PR @sandylaker ! |
@vfdev-5 Thanks for pointing out that.
|
@sandylaker I think we can do as we are doing for ignite/ignite/engine/engine.py Line 598 in 8a1de70
Sorry, I didn't quite follow everything in the code for cc @fco-dv |
@vfdev-5 So that means: we encourage the users to use ema_handler = EMAHandler(momentum=0.2, momentum_warmup=0.02, warmup_iters=100) Then,
|
@sandylaker yes, I was thinking about something like that. Do you think this is too restrictive ? In terms of API, I agree that it would require 2-3 additional lines with a state param scheduler in order to have the same behaviour. On the other hand we can keep both things: |
Signed-off-by: sandylaker <yawei.li@tum.de>
…uler.py Signed-off-by: sandylaker <yawei.li@tum.de>
@vfdev-5 I think it is better to do like this:
Because some users hope to schedule the So I think doing this will not break the BC. |
@sandylaker sorry for delay, OK, I agree with you and let's make it as you are suggesting. |
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 the updates @sandylaker (and sorry for delay)
I left few other comments...
It would be nice to provide an explicit example in the docs on how to do the warm-up. Further more I wonder how could we simplify more explicit state param scheduler creation and make it a one-liner... @fco-dv any ideas ?
engine_1.add_event_handler( | ||
Events.ITERATION_COMPLETED, check_ema_momentum, momentum_warmup_1, momentum, warmup_iters | ||
) | ||
engine_1.run(range(2)) |
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.
Shouldn't we make at least 10 iters to properly check the scheduler ?
engine_2.add_event_handler( | ||
Events.ITERATION_COMPLETED, check_ema_momentum, momentum_warmup_2, momentum, warmup_iters | ||
) | ||
engine_2.run(range(2)) |
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.
Same here, IMO
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 a lot for the updates @sandylaker !
I'll update the tests and can merge the PR then
* deprecate warmup function in ema_handler.py Signed-off-by: sandylaker <yawei.li@tum.de> * keep the previous API but throw warnings Signed-off-by: sandylaker <yawei.li@tum.de> * revert changes to state_param_scheduler.py and test_state_param_scheduler.py Signed-off-by: sandylaker <yawei.li@tum.de> * use `LambdaStateScheduler` to schedule EMA momentum * fix docs * fix mypy * Apply suggestions from code review Co-authored-by: vfdev <vfdev.5@gmail.com>
Fixes #2294
Description:
Check list: