Skip to content

Commit

Permalink
zeros([]
Browse files Browse the repository at this point in the history
  • Loading branch information
NouamaneTazi committed Feb 1, 2024
1 parent 5d822bb commit 063020a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nanotron/optim/clip_grads.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def clip_grad_norm(
torch.stack([torch.linalg.vector_norm(g.detach(), ord=torch.inf, dtype=torch.float) for g in grads])
)
else:
total_norm = torch.zeros(1, dtype=torch.float, device=torch.device("cuda"))
total_norm = torch.zeros([], dtype=torch.float, device=torch.device("cuda"))
dist.all_reduce(total_norm, group=mp_pg, op=dist.ReduceOp.MAX)

else:
Expand Down

0 comments on commit 063020a

Please sign in to comment.