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
1c965000
Commit
1c965000
authored
Sep 27, 2021
by
Sylvain Gugger
Browse files
Fix gather for SageMaker model parallel
parent
4e0410e9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
src/transformers/trainer_pt_utils.py
src/transformers/trainer_pt_utils.py
+1
-0
No files found.
src/transformers/trainer_pt_utils.py
View file @
1c965000
...
@@ -1021,6 +1021,7 @@ if is_sagemaker_mp_enabled():
...
@@ -1021,6 +1021,7 @@ if is_sagemaker_mp_enabled():
f
"Can't gather the values of type
{
type
(
tensor
)
}
, only of nested list/tuple/dicts of tensors."
f
"Can't gather the values of type
{
type
(
tensor
)
}
, only of nested list/tuple/dicts of tensors."
)
)
all_tensors
=
smp
.
allgather
(
tensor
,
smp
.
CommGroup
.
DP_GROUP
)
all_tensors
=
smp
.
allgather
(
tensor
,
smp
.
CommGroup
.
DP_GROUP
)
all_tensors
=
[
t
if
len
(
t
.
shape
)
>
0
else
t
[
None
]
for
t
in
all_tensors
]
return
torch
.
cat
([
t
.
cpu
()
for
t
in
all_tensors
],
dim
=
0
)
return
torch
.
cat
([
t
.
cpu
()
for
t
in
all_tensors
],
dim
=
0
)
def
smp_nested_concat
(
tensor
):
def
smp_nested_concat
(
tensor
):
...
...
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