Lightning-AI / Lightning-AI/pytorch-lightning

Make logging_mode (`on_step` or `on_epoch`) available to loggers

Open
#20,502 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

### Description & Motivation

Lightning lets you log `on_step`, or `on_epoch`. However, even when using `on_epoch`, the global step is logged on the x-axis, not the epoch number.

Loggers can manually extract `epoch` from the logged metrics and pass that as the `step`. However, this would break `on_step` logging.

Making the logging mode for a logging call available would let loggers conditionally use either the `global_step` or `current_epoch` as the `step` for that particular metric.

### Pitch

_No response_

### Alternatives

_No response_

### Additional context

_No response_

cc @lantiga @borda

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

No files, tests, or entry points are identified in the issue. Start by tracing how logging calls pass metrics to loggers and determine where on_step or on_epoch can remain associated with each metric. Done means loggers can choose global_step for on_step metrics and current_epoch for on_epoch metrics without breaking either mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
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.