Refactor `_get_rank` utility to take strategy instead of trainer (#14546)

This commit is contained in:
Adrian Wälchli 2022-09-07 22:56:39 +02:00 committed by GitHub
parent 06fa9ea3e0
commit 59fcabf53a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -261,7 +261,7 @@ class EarlyStopping(Callback):
@staticmethod
def _log_info(trainer: Optional["pl.Trainer"], message: str, log_rank_zero_only: bool) -> None:
rank = _get_rank(trainer)
rank = _get_rank(strategy=(trainer.strategy if trainer is not None else None))
if trainer is not None and trainer.world_size <= 1:
rank = None
message = rank_prefixed_message(message, rank)