Skip to content

Commit 59fcabf

Browse files
authored
Refactor _get_rank utility to take strategy instead of trainer (#14546)
1 parent 06fa9ea commit 59fcabf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pytorch_lightning/callbacks/early_stopping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def _improvement_message(self, current: Tensor) -> str:
261261

262262
@staticmethod
263263
def _log_info(trainer: Optional["pl.Trainer"], message: str, log_rank_zero_only: bool) -> None:
264-
rank = _get_rank(trainer)
264+
rank = _get_rank(strategy=(trainer.strategy if trainer is not None else None))
265265
if trainer is not None and trainer.world_size <= 1:
266266
rank = None
267267
message = rank_prefixed_message(message, rank)

0 commit comments

Comments
 (0)