-
Notifications
You must be signed in to change notification settings - Fork 363
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
[CodeCamp #28] support ReduceOnPlateau #819
[CodeCamp #28] support ReduceOnPlateau #819
Conversation
… param_schedulers built
self._init_is_better( | ||
rule=self.rule, | ||
threshold=self.threshold, | ||
threshold_rule=self.threshold_rule) |
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.
It seems not necessary to call self._init_is_better
here. self.__dict__.update(state_dict)
will also update its attributes.
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.
It is necessary when the cfg is different from cfg in state_dict.
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.
[Fix] fix small bug
Co-authored-by: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
… ReduceOnPlateauLR docs
…and ReduceOnPlateauMomentum
@@ -74,6 +76,72 @@ def test_after_epoch(self): | |||
scheduler2.step = Mock() | |||
scheduler2.by_epoch = True | |||
runner.param_schedulers = dict(key1=[scheduler1], key2=[scheduler2]) | |||
hook.after_train_iter(runner, 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 it necessary to call this method here?
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 will del it.
scheduler.need_val_args = True | ||
runner.param_schedulers = scheduler | ||
hook.after_val_epoch(runner, metrics) | ||
scheduler.step.assert_called_with(metrics) |
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 step
method of scheduler
will not be called so this line can be moved to make ut clear.
Hi @LEFTeyex , thanks for your contribution. This PR can be merged after resolving the above comments. |
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
…dd_reduceonplateauparamscheduler
Hi @zhouzaida, I have done. |
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
The task to support ReduceLROnPlateau in OpenMMLab Code Camp.
Modification
Add
ReduceOnPlateauParamScheduler
,ReduceOnPlateauLR
,ReduceOnPlateauMomentum
class and addafter_val_epoch
hook position to support ReduceLROnPlateau.BC-breaking (Optional)
Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
Use cases (Optional)
It will be supplemented later.
Checklist