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
7edc33ac
Unverified
Commit
7edc33ac
authored
Jul 12, 2023
by
Zach Mueller
Committed by
GitHub
Jul 12, 2023
Browse files
Fix eval_accumulation_steps leading to incorrect metrics (#24756)
Fix eval steps
parent
45025d92
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/trainer.py
src/transformers/trainer.py
+1
-1
No files found.
src/transformers/trainer.py
View file @
7edc33ac
...
@@ -3154,7 +3154,7 @@ class Trainer:
...
@@ -3154,7 +3154,7 @@ class Trainer:
self
.
control
=
self
.
callback_handler
.
on_prediction_step
(
args
,
self
.
state
,
self
.
control
)
self
.
control
=
self
.
callback_handler
.
on_prediction_step
(
args
,
self
.
state
,
self
.
control
)
# Gather all tensors and put them back on the CPU if we have done enough accumulation steps.
# Gather all tensors and put them back on the CPU if we have done enough accumulation steps.
if
args
.
eval_accumulation_steps
is
not
None
and
(
step
+
1
)
%
args
.
eval_accumulation_steps
==
0
:
if
args
.
eval_accumulation_steps
is
not
None
and
self
.
accelerator
.
sync_gradients
:
if
losses_host
is
not
None
:
if
losses_host
is
not
None
:
losses
=
nested_numpify
(
losses_host
)
losses
=
nested_numpify
(
losses_host
)
all_losses
=
losses
if
all_losses
is
None
else
np
.
concatenate
((
all_losses
,
losses
),
axis
=
0
)
all_losses
=
losses
if
all_losses
is
None
else
np
.
concatenate
((
all_losses
,
losses
),
axis
=
0
)
...
...
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