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
ad98642a
"tests/encoder_decoder/test_modeling_encoder_decoder.py" did not exist on "81d6841b4be25a164235975e5ebdcf99d7a26633"
Unverified
Commit
ad98642a
authored
Oct 05, 2022
by
Zachary Mueller
Committed by
GitHub
Oct 05, 2022
Browse files
Fix gather for metrics (#19360)
parent
d9101b71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
examples/pytorch/summarization/run_summarization_no_trainer.py
...les/pytorch/summarization/run_summarization_no_trainer.py
+1
-1
No files found.
examples/pytorch/summarization/run_summarization_no_trainer.py
View file @
ad98642a
...
@@ -685,7 +685,7 @@ def main():
...
@@ -685,7 +685,7 @@ def main():
# If we did not pad to max length, we need to pad the labels too
# If we did not pad to max length, we need to pad the labels too
labels
=
accelerator
.
pad_across_processes
(
batch
[
"labels"
],
dim
=
1
,
pad_index
=
tokenizer
.
pad_token_id
)
labels
=
accelerator
.
pad_across_processes
(
batch
[
"labels"
],
dim
=
1
,
pad_index
=
tokenizer
.
pad_token_id
)
generated_tokens
,
labels
=
accelerator
.
gather_for_metrics
(
generated_tokens
,
labels
)
generated_tokens
,
labels
=
accelerator
.
gather_for_metrics
(
(
generated_tokens
,
labels
)
)
generated_tokens
=
generated_tokens
.
cpu
().
numpy
()
generated_tokens
=
generated_tokens
.
cpu
().
numpy
()
labels
=
labels
.
cpu
().
numpy
()
labels
=
labels
.
cpu
().
numpy
()
...
...
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