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
244e1b5b
Unverified
Commit
244e1b5b
authored
Sep 22, 2020
by
Sylvain Gugger
Committed by
GitHub
Sep 22, 2020
Browse files
Fix #7304 (#7305)
parent
e4610881
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/trainer.py
src/transformers/trainer.py
+2
-2
No files found.
src/transformers/trainer.py
View file @
244e1b5b
...
@@ -1334,9 +1334,9 @@ class Trainer:
...
@@ -1334,9 +1334,9 @@ class Trainer:
elif
is_torch_tpu_available
():
elif
is_torch_tpu_available
():
# tpu-comment: Get all predictions and labels from all worker shards of eval dataset
# tpu-comment: Get all predictions and labels from all worker shards of eval dataset
if
preds
is
not
None
:
if
preds
is
not
None
:
preds
=
nested_xla_mesh_reduce
(
"eval_preds"
,
preds
)
preds
=
nested_xla_mesh_reduce
(
preds
,
"eval_preds"
)
if
label_ids
is
not
None
:
if
label_ids
is
not
None
:
label_ids
=
nested_xla_mesh_reduce
(
"eval_
label_ids
"
,
label_ids
,
torch
.
cat
)
label_ids
=
nested_xla_mesh_reduce
(
label_ids
,
"eval_
label_ids
"
)
if
eval_losses
is
not
None
:
if
eval_losses
is
not
None
:
eval_losses
=
xm
.
mesh_reduce
(
"eval_losses"
,
torch
.
tensor
(
eval_losses
),
torch
.
cat
).
tolist
()
eval_losses
=
xm
.
mesh_reduce
(
"eval_losses"
,
torch
.
tensor
(
eval_losses
),
torch
.
cat
).
tolist
()
...
...
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