You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am using SpeechBrain's Transducer recipe for Common Voice to train an ASR, and I found that only the main process's metrics were logged when I used DDP. Here's the modified on_stage_end() method:
defon_stage_end(self, stage, stage_loss, epoch):
"""Gets called at the end of a epoch."""# Compute/store important statsstage_stats= {"loss": stage_loss}
ifstage==sb.Stage.TRAIN:
print(f'[rank {torch.distributed.get_rank()}] Epoch {epoch} training loss: {stage_loss:.4f}')
self.train_stats=stage_statselse:
stage_stats["CER"] =self.cer_metric.summarize("error_rate")
# Perform end-of-iteration things, like annealing, logging, etc.ifstage==sb.Stage.VALID:
lr=self.hparams.noam_annealing.current_lrsteps=self.optimizer_stepoptimizer=self.optimizer.__class__.__name__epoch_stats= {
"epoch": epoch,
"lr": lr,
"steps": steps,
"optimizer": optimizer,
}
self.hparams.train_logger.log_stats(
stats_meta=epoch_stats,
train_stats=self.train_stats,
valid_stats=stage_stats,
)
print(f'[rank {torch.distributed.get_rank()}] Epoch {epoch} CER {stage_stats["CER"]:.4f}')
self.checkpointer.save_and_keep_only(
meta={"CER": stage_stats["CER"], "epoch": epoch},
min_keys=["CER"],
num_to_keep=self.hparams.avg_checkpoints,
ckpt_predicate=lambdackpt: ckpt.meta.get("CER")!=-0.1
)
And the output was (tqdm's progress bar is removed)
Apparently only the main process's metrics were logged. And when I looked at the train logger's implementation, log_stats was indeed main-process-only.
Could you explain to me why it is so? I am relatively new to DDP but perhaps naively I think that all processes' metrics should first be averaged then logged. Thank you for your help!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am using SpeechBrain's Transducer recipe for Common Voice to train an ASR, and I found that only the main process's metrics were logged when I used DDP. Here's the modified
on_stage_end()method:And the output was (tqdm's progress bar is removed)
Apparently only the main process's metrics were logged. And when I looked at the train logger's implementation,
log_statswas indeed main-process-only.Could you explain to me why it is so? I am relatively new to DDP but perhaps naively I think that all processes' metrics should first be averaged then logged. Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions