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

pull/5447/head
Camille Zhong 9 months ago committed by GitHub
parent 8020f42630
commit da885ed540
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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

Loading…
Cancel
Save