Skip to content

Commit

Permalink
Stitcher: Console log only on rank0
Browse files Browse the repository at this point in the history
  • Loading branch information
vinamarora8 committed Nov 16, 2024
1 parent 024cd27 commit 6308be5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions torch_brain/utils/stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,18 @@ def on_validation_epoch_end(self, trainer, pl_module, prefix="val"):

# log the metrics
self.log_dict(metrics)
if not self.quiet:
logging.info(f"Logged {len(metrics)} {prefix} metrics.")

metrics_data = []
for metric_name, metric_value in metrics.items():
metrics_data.append({"metric": metric_name, "value": metric_value.item()})

metrics_df = pd.DataFrame(metrics_data)
if not self.quiet:
rprint(metrics_df)

if trainer.is_global_zero:
if not self.quiet:
logging.info(f"Logged {len(metrics)} {prefix} metrics.")
rprint(metrics_df)

for logger in trainer.loggers:
if isinstance(logger, L.pytorch.loggers.TensorBoardLogger):
logger.experiment.add_text(
Expand Down

0 comments on commit 6308be5

Please sign in to comment.