Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
9322576e
Unverified
Commit
9322576e
authored
Mar 06, 2024
by
Zach Mueller
Committed by
GitHub
Mar 06, 2024
Browse files
Fix test failure on DeepSpeed (#29444)
* Fix test failure * use item
parent
0a5b0516
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/transformers/trainer.py
src/transformers/trainer.py
+4
-1
No files found.
src/transformers/trainer.py
View file @
9322576e
...
@@ -2011,7 +2011,10 @@ class Trainer:
...
@@ -2011,7 +2011,10 @@ class Trainer:
is_accelerate_available
()
is_accelerate_available
()
and
self
.
accelerator
.
distributed_type
==
DistributedType
.
DEEPSPEED
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
:
else
:
grad_norm
=
_grad_norm
.
item
()
if
_grad_norm
is
not
None
else
None
grad_norm
=
_grad_norm
.
item
()
if
_grad_norm
is
not
None
else
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment