Unverified Commit 9ddbb696 authored by Liangliang-Ma's avatar Liangliang-Ma Committed by GitHub
Browse files

Fix unsupported setting of self._n_gpu in training_args on XPU devices (#27716)

change xpu _n_gpu = 1
parent 29f1aee3
...@@ -1879,7 +1879,7 @@ class TrainingArguments: ...@@ -1879,7 +1879,7 @@ class TrainingArguments:
elif self.distributed_state.distributed_type == DistributedType.MULTI_XPU: elif self.distributed_state.distributed_type == DistributedType.MULTI_XPU:
if "ACCELERATE_USE_XPU" not in os.environ: if "ACCELERATE_USE_XPU" not in os.environ:
os.environ["ACCELERATE_USE_XPU"] = "true" os.environ["ACCELERATE_USE_XPU"] = "true"
self._n_gpu = torch.xpu.device_count() self._n_gpu = 1
device = torch.device("xpu:0") device = torch.device("xpu:0")
torch.xpu.set_device(device) torch.xpu.set_device(device)
elif self.distributed_state.distributed_type == DistributedType.NO: elif self.distributed_state.distributed_type == DistributedType.NO:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment