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
c38a1227
"test/ut/vscode:/vscode.git/clone" did not exist on "1b01a7e3c73d874ecdeaf77d9edaf97c0f718c44"
Unverified
Commit
c38a1227
authored
Mar 04, 2024
by
Traun Leyden
Committed by
GitHub
Mar 04, 2024
Browse files
Workaround for #27758 to avoid ZeroDivisionError (#28756)
parent
704b3f74
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/transformers/trainer.py
src/transformers/trainer.py
+2
-1
No files found.
src/transformers/trainer.py
View file @
c38a1227
...
...
@@ -2080,7 +2080,8 @@ class Trainer:
# add remaining tr_loss
self
.
_total_loss_scalar
+=
tr_loss
.
item
()
train_loss
=
self
.
_total_loss_scalar
/
self
.
state
.
global_step
effective_global_step
=
max
(
self
.
state
.
global_step
,
0.001
)
# Avoid ZeroDivisionError
train_loss
=
self
.
_total_loss_scalar
/
effective_global_step
metrics
=
speed_metrics
(
"train"
,
...
...
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