Skip to content

Commit

Permalink
[shardformer] add all_reduce operation to loss
Browse files Browse the repository at this point in the history
add all_reduce operation to loss
  • Loading branch information
flybird11111 authored Sep 4, 2023
1 parent 9ac6dc6 commit c9cfa8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/language/bert/finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def evaluate_subset(dataloader: DataLoader):
metric.add_batch(predictions=preds, references=labels)

results = metric.compute()

dist.all_reduce(accum_loss.div_(len(dataloader)))
if coordinator.is_master() and results is not None:
results['loss'] = accum_loss.item() / coordinator.world_size

Expand Down

0 comments on commit c9cfa8c

Please sign in to comment.