Lightning-AI / Lightning-AI/pytorch-lightning

Easier access to train_batch_idx for control

Open
#20,240 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

### Description & Motivation

Global step is defined in terms of optimizer steps, for multi optimizer training most flow control is easier defined in terms of train batches

### Pitch

There are possibilities to access the train batch index for example with `self.trainer.fit_loop.batch_idx` but for example there is no option to use instead of Trainer `max_steps`. The suggestion is to provide an option to use train_batch_idx instead of steps in all APIs.

### Alternatives

Leave unchanged

### Additional context

_No response_

cc @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

Start with the exposed self.trainer.fit_loop.batch_idx entry point and the Trainer max_steps API mentioned in the issue. Trace how step limits are consumed across the training APIs, then define the affected scope and verify that train-batch-based control works consistently with multi-optimizer training.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.