Browse Source

[exampe] fix llama example' loss error when using gemini plugin (#5060)

fix llama example
pull/5069/head
flybird11111 1 year ago committed by GitHub
parent
commit
bc09b95f50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      examples/language/llama2/finetune.py

1
examples/language/llama2/finetune.py

@ -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

Loading…
Cancel
Save