Skip to content

Commit

Permalink
patch for smddp import (huggingface#18244)
Browse files Browse the repository at this point in the history
* add import

* format
  • Loading branch information
carolynwang authored and oneraghavan committed Sep 26, 2022
1 parent 174d422 commit 858683a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/transformers/training_args.py
Expand Up @@ -1333,6 +1333,8 @@ def _setup_devices(self) -> "torch.device":
device = torch.device("cuda", local_rank)
self._n_gpu = 1
elif is_sagemaker_dp_enabled():
import smdistributed.dataparallel.torch.torch_smddp # noqa: F401

dist.init_process_group(backend="smddp")
self.local_rank = int(os.getenv("SMDATAPARALLEL_LOCAL_RANK"))
device = torch.device("cuda", self.local_rank)
Expand Down

0 comments on commit 858683a

Please sign in to comment.