fix tensor data update for gemini loss caluculation (#5442)

pull/5447/head
Camille Zhong 2024-03-11 13:49:58 +08:00 committed by GitHub
parent 8020f42630
commit da885ed540
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -56,6 +56,7 @@ def format_numel_str(numel: int) -> str:
def all_reduce_mean(tensor: torch.Tensor) -> torch.Tensor:
dist.all_reduce(tensor=tensor, op=dist.ReduceOp.SUM)
tensor = tensor.data
tensor.div_(dist.get_world_size())
return tensor