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

LearningRateMonitor callback doesn't work with manual optimization #15777

Closed
nikvaessen opened this issue Nov 22, 2022 · 3 comments · Fixed by #16308
Closed

LearningRateMonitor callback doesn't work with manual optimization #15777

nikvaessen opened this issue Nov 22, 2022 · 3 comments · Fixed by #16308
Labels
bug Something isn't working callback: lr monitor
Milestone

Comments

@nikvaessen
Copy link
Contributor

nikvaessen commented Nov 22, 2022

Bug description

When setting self.automatic_optimization to False in a LightningModule, a LearningRateMonitor callback will not log the learning rate, even though lr_schedule.step() is called.

How to reproduce the bug

https://colab.research.google.com/drive/16wvrmKqGtVrOCd8Uo3K83WLeIATChFbF?usp=sharing

Error messages and logs

See colab

Environment

See colab

More info

It seems trainer._logger_connector.should_update_logs at https://github.com/Lightning-AI/lightning/blob/8266300b29e14d719945e153dcb18743c0449966/src/pytorch_lightning/callbacks/lr_monitor.py#L151 is False, and therefore no logging takes place.

cc @carmocca @nbcsm @guotuofeng

@nikvaessen nikvaessen added the needs triage Waiting to be triaged by maintainers label Nov 22, 2022
@Borda Borda added bug Something isn't working profiler and removed needs triage Waiting to be triaged by maintainers labels Dec 5, 2022
@Borda
Copy link
Member

Borda commented Dec 5, 2022

@carmocca mind having a look? 🐰

@stale
Copy link

stale bot commented Jan 8, 2023

This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions - the Lightning Team!

@stale stale bot added the won't fix This will not be worked on label Jan 8, 2023
@carmocca carmocca added won't fix This will not be worked on profiler callback: lr monitor and removed profiler won't fix This will not be worked on labels Jan 9, 2023
@stale stale bot removed the won't fix This will not be worked on label Jan 9, 2023
@carmocca carmocca added this to the v1.9 milestone Jan 9, 2023
@carmocca
Copy link
Contributor

carmocca commented Jan 9, 2023

Hi @nikvaessen. Thanks for reporting this issue. I've identified the cause.

As a workaround. You can set LearningRateMonitor(logging_interval="step") to avoid it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working callback: lr monitor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants