fix experiments for waveflow and wavenet, only write visual log in rank-0

This commit is contained in:
chenfeiyu 2021-02-21 17:30:13 +08:00
parent 3ebe5ccb33
commit 7b0de356f9
2 changed files with 6 additions and 4 deletions

View File

@ -118,8 +118,9 @@ class Experiment(ExperimentBase):
iteration_time)
msg += "loss: {:>.6f}".format(loss_value)
self.logger.info(msg)
self.visualizer.add_scalar(
"train/loss", loss_value, global_step=self.iteration)
if dist.get_rank() == 0:
self.visualizer.add_scalar(
"train/loss", loss_value, global_step=self.iteration)
@mp_tools.rank_zero_only
@paddle.no_grad()

View File

@ -131,8 +131,9 @@ class Experiment(ExperimentBase):
iteration_time)
msg += "loss: {:>.6f}".format(loss_value)
self.logger.info(msg)
self.visualizer.add_scalar(
"train/loss", loss_value, global_step=self.iteration)
if dist.get_rank() == 0:
self.visualizer.add_scalar(
"train/loss", loss_value, global_step=self.iteration)
@mp_tools.rank_zero_only
@paddle.no_grad()