Update training_args.py - addition of self.distributed_state when using 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>
This commit is contained in:
Serizao 2023-09-13 20:21:46 +02:00 committed by GitHub
parent 0fced06788
commit e52f1cb669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1803,6 +1803,7 @@ class TrainingArguments:
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():