Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dllogger - log on rank 0 only #7513

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading