Skip to content

Remove an unnecessary TODO in src/lightning/pytorch/loops/fit_loop.py #20998

@GoldenStain

Description

@GoldenStain

Outline & Motivation

On line 178, there'a TODO item:

# TODO: Move track steps inside training loop and move part of these condition inside training loop
    stop_steps = _is_max_limit_reached(self.epoch_loop.global_step, self.max_steps)
    if stop_steps:
        rank_zero_info(f"`Trainer.fit` stopped: `max_steps={self.max_steps!r}` reached.")
        return True

Since global_step takes effect cross epoches, it's reasonable to perform this check here.
If we remove this check, then we need to add a flag variable, which is set to True when we hit max_steps in epoch_loop, which doesn't make things better.

Pitch

Remove this TODO to make code cleaner.

Additional context

No response

cc @lantiga @justusschock

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions