Skip to content

Commit

Permalink
[exampe] fix llama example' loss error when using gemini plugin (#5060)
Browse files Browse the repository at this point in the history
fix llama example
  • Loading branch information
flybird11111 authored Nov 18, 2023
1 parent 3c08f17 commit bc09b95
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions examples/language/llama2/finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def tokenize_batch_for_finetune(batch, tokenizer: Optional[LlamaTokenizer] = Non

def all_reduce_mean(tensor: torch.Tensor) -> torch.Tensor:
dist.all_reduce(tensor, op=dist.ReduceOp.SUM)
tensor = tensor.data
tensor.div_(dist.get_world_size())
return tensor

Expand Down

0 comments on commit bc09b95

Please sign in to comment.