Skip to content

Commit

Permalink
dllogger - log on rank 0 only (#7513)
Browse files Browse the repository at this point in the history
Signed-off-by: Stas Bekman <[email protected]>
  • Loading branch information
stas00 committed Sep 26, 2023
1 parent cdc9643 commit 099ddb9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nemo/utils/loggers/dllogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from lightning_utilities.core.apply_func import apply_to_collection
from omegaconf import DictConfig, ListConfig, OmegaConf
from pytorch_lightning.loggers import Logger
from pytorch_lightning.utilities import rank_zero_only
from pytorch_lightning.utilities.parsing import AttributeDict

from nemo.utils import logging
Expand Down Expand Up @@ -81,6 +82,7 @@ def __init__(self, stdout: bool, verbose: bool, json_file: str):
)
dllogger.init(backends=backends)

@rank_zero_only
def log_hyperparams(self, params, *args, **kwargs):
if isinstance(params, Namespace):
params = vars(params)
Expand All @@ -91,6 +93,7 @@ def log_hyperparams(self, params, *args, **kwargs):
params = _sanitize_callable_params(_flatten_dict(_convert_params(params)))
dllogger.log(step="PARAMETER", data=params)

@rank_zero_only
def log_metrics(self, metrics, step=None):
if step is None:
step = tuple()
Expand Down

0 comments on commit 099ddb9

Please sign in to comment.