Skip to content

Commit

Permalink
Update src/nanotron/trainer.py
Browse files Browse the repository at this point in the history
Co-authored-by: AleHC <[email protected]>
  • Loading branch information
kylematoba and AleHD authored Nov 22, 2024
1 parent ace4d33 commit 8659582
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/nanotron/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,10 @@ def train(
self.valid_metadata.last_train_step = self.iteration_step
self.valid_metadata.data_stages[self.valid_metadata.last_stage_idx].consumed_train_samples += self.global_batch_size

log_entries = [LogItem("validation_loss_avg", loss_avg, "human_format")]
self.loggerwriter.add_scalars_from_list(log_entries, self.iteration_step)
if dist.get_rank(self.parallel_context.world_pg) in self.logger_ranks:
log_entries = [LogItem("validation_loss_avg", loss_avg, "human_format")]
self.loggerwriter.add_scalars_from_list(log_entries, self.iteration_step)


# NOTE: only one rank writes to wandb
if dist.get_rank(self.parallel_context.world_pg) == self.logger_ranks[0] and wandb is not None:
Expand Down

0 comments on commit 8659582

Please sign in to comment.