Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
4e0410e9
Commit
4e0410e9
authored
Sep 27, 2021
by
Sylvain Gugger
Browse files
Fix in gather for SM distributed
parent
367c2ef5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/trainer_pt_utils.py
src/transformers/trainer_pt_utils.py
+1
-1
No files found.
src/transformers/trainer_pt_utils.py
View file @
4e0410e9
...
...
@@ -162,8 +162,8 @@ def distributed_concat(tensor: Any, num_total_examples: Optional[int] = None) ->
if
isinstance
(
tensor
,
(
tuple
,
list
)):
return
type
(
tensor
)(
distributed_concat
(
t
,
num_total_examples
)
for
t
in
tensor
)
output_tensors
=
[
tensor
.
clone
()
for
_
in
range
(
dist
.
get_world_size
())]
dist
.
all_gather
(
output_tensors
,
tensor
)
output_tensors
=
[
t
if
len
(
t
.
shape
)
>
0
else
t
[
None
]
for
t
in
output_tensors
]
dist
.
all_gather
(
output_tensors
,
tensor
)
concat
=
torch
.
cat
(
output_tensors
,
dim
=
0
)
# truncate the dummy elements added by SequentialDistributedSampler
...
...
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