Lightning-AI / Lightning-AI/pytorch-lightning

Refactor LearningRateMonitor

Open
#17,613 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

callback: lr monitor feature help wanted refactor
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Outline & Motivation

- `self.last_momentum_values` does not seem needed, but I may be overlooking something.
- Instead of returning the name with `-momentum` suffix when logging betas, just log it with `-beta` suffix.
- If logging betas, log all of them. The name could therefore be `-beta0`, `-beta1` in the case of Adam.
- Change the current logging names, e.g., `lr-Adam` to `optimizer-Adam-lr` and `lr-Adam-momentum` to `optimizer-Adam-momentum` (it doesn't have momentum this is just for demonstration, it would actually be `optimizer-Adam-beta0`, `optimizer-Adam-beta1`).
- remove the `log_momentum` argument as it can be inferred automatically.

### Pitch

Happy to open a PR with these changes.

### Additional context

_No response_

cc @borda @justusschock @awaelchli

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the LearningRateMonitor implementation and its tests, then trace how optimizer learning rates, momentum, and betas are currently discovered and logged. Done means the unnecessary state and argument are removed, all requested logging names and beta values are covered, and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.