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
22a0dd2e
Unverified
Commit
22a0dd2e
authored
Aug 03, 2022
by
Sourab Mangrulkar
Committed by
GitHub
Aug 03, 2022
Browse files
fixing error when using sharded ddp (#18435)
parent
5096a654
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
3 deletions
+1
-3
src/transformers/trainer.py
src/transformers/trainer.py
+1
-3
No files found.
src/transformers/trainer.py
View file @
22a0dd2e
...
...
@@ -1344,9 +1344,8 @@ class Trainer:
reshard_after_forward
=
zero_3
,
cpu_offload
=
cpu_offload
,
).
to
(
self
.
args
.
device
)
# Distributed training using PyTorch FSDP
if
self
.
fsdp
is
not
None
:
el
if
self
.
fsdp
is
not
None
:
# PyTorch FSDP!
from
torch.distributed.fsdp.fully_sharded_data_parallel
import
CPUOffload
from
torch.distributed.fsdp.fully_sharded_data_parallel
import
FullyShardedDataParallel
as
FSDP
...
...
@@ -1394,7 +1393,6 @@ class Trainer:
)
if
FSDPOption
.
OFFLOAD
not
in
self
.
args
.
fsdp
:
model
.
to
(
self
.
args
.
device
)
elif
is_sagemaker_dp_enabled
():
model
=
nn
.
parallel
.
DistributedDataParallel
(
model
,
device_ids
=
[
int
(
os
.
getenv
(
"SMDATAPARALLEL_LOCAL_RANK"
))]
...
...
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