Skip to content
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

ReduceLROnPlateau scheduler type check #1114

Closed
alexeykarnachev opened this issue Mar 10, 2020 · 4 comments · Fixed by #1126
Closed

ReduceLROnPlateau scheduler type check #1114

alexeykarnachev opened this issue Mar 10, 2020 · 4 comments · Fixed by #1126
Labels
bug Something isn't working good first issue Good for newcomers help wanted Open to be worked on let's do it! approved to implement
Milestone

Comments

@alexeykarnachev
Copy link
Contributor

alexeykarnachev commented Mar 10, 2020

🐛 Bug

Incorrect type check for scheduler of class ReduceLROnPlateau.
https://github.com/PyTorchLightning/pytorch-lightning/blob/bc01b9ac1c0ddf503f83755c00d5541a2679e5b4/pytorch_lightning/trainer/trainer.py#L713

I believe, this check:
isinstance(scheduler, optim.lr_scheduler.ReduceLROnPlateau)

must look like this:
isinstance(scheduler['scheduler'], optim.lr_scheduler.ReduceLROnPlateau)

To Reproduce

Steps to reproduce the behavior:

  1. Create a scheduler of type optim.lr_scheduler.ReduceLROnPlateau in the configure_optimizers method of a LightningModule class.
  2. Return an optimizer and scheduler from this method. Place them in lists: return [optimizer], [scheduler].
  3. Execute the trainer.fit(module).
  4. Put a break-point here: https://github.com/PyTorchLightning/pytorch-lightning/blob/bc01b9ac1c0ddf503f83755c00d5541a2679e5b4/pytorch_lightning/trainer/trainer.py#L712
  5. Make sure that the condition is never True.
@alexeykarnachev alexeykarnachev added bug Something isn't working help wanted Open to be worked on labels Mar 10, 2020
@github-actions
Copy link
Contributor

Hi! thanks for your contribution!, great first issue!

@Borda Borda changed the title BUG: ReduceLROnPlateau scheduler type check ReduceLROnPlateau scheduler type check Mar 11, 2020
@Borda
Copy link
Member

Borda commented Mar 11, 2020

@SkafteNicki could you pls check it? as it comes from your PR :]

@SkafteNicki
Copy link
Member

I agree with @alexeykarnachev that this is indeed a bug, that I introduced with the recent rework of the learning rate schedulers. I can send a new PR with the bug fix and include a test for ReduceLROnPlateau schedulers

@Borda
Copy link
Member

Borda commented Mar 12, 2020

Thx guys!
@alexeykarnachev minds send fix PR?

@Borda Borda added good first issue Good for newcomers let's do it! approved to implement labels Mar 12, 2020
@Borda Borda added this to the 0.7.2 milestone Mar 12, 2020
@Borda Borda modified the milestones: v0.7., v0.7.x Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Open to be worked on let's do it! approved to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants