Skip to content

Commit

Permalink
Update training_args.py - addition of self.distributed_state when usi…
Browse files Browse the repository at this point in the history
…ng XPU (#25999)

* Update training_args.py

Missing distributed state so lign 1813-1814 failed because value is undefined

* Update training_args.py

Co-authored-by: Zach Mueller <muellerzr@gmail.com>

---------

Co-authored-by: Zach Mueller <muellerzr@gmail.com>
  • Loading branch information
Serizao and muellerzr authored Sep 13, 2023
1 parent 0fced06 commit e52f1cb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/transformers/training_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,7 @@ def _setup_devices(self) -> "torch.device":
torch.cuda.set_device(device)
elif is_torch_xpu_available() and "ACCELERATE_USE_XPU" not in os.environ:
os.environ["ACCELERATE_USE_XPU"] = "true"
self.distributed_state = PartialState(timeout=timedelta(seconds=self.ddp_timeout))
device = torch.device("xpu:0")
self._n_gpu = 1
elif is_sagemaker_dp_enabled():
Expand Down

0 comments on commit e52f1cb

Please sign in to comment.