mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
parent
0a5b0516f8
commit
9322576e2f
@ -2011,7 +2011,10 @@ class Trainer:
|
||||
is_accelerate_available()
|
||||
and self.accelerator.distributed_type == DistributedType.DEEPSPEED
|
||||
):
|
||||
grad_norm = model.get_global_grad_norm().item()
|
||||
grad_norm = model.get_global_grad_norm()
|
||||
# In some cases the grad norm may not return a float
|
||||
if hasattr(grad_norm, "item"):
|
||||
grad_norm = grad_norm.item()
|
||||
else:
|
||||
grad_norm = _grad_norm.item() if _grad_norm is not None else None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user