Skip to content

Commit 476be08

Browse files
authored
Check for accelerate env var when doing CPU only (#24890)
Check for use-cpu
1 parent a982c02 commit 476be08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/transformers/training_args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ def _setup_devices(self) -> "torch.device":
17201720
self.distributed_state = None
17211721
if not self.use_ipex and "ACCELERATE_USE_IPEX" not in os.environ:
17221722
os.environ["ACCELERATE_USE_IPEX"] = "false"
1723-
if self.use_cpu:
1723+
if self.use_cpu or os.environ.get("ACCELERATE_USE_CPU", False):
17241724
self.distributed_state = PartialState(cpu=True, backend=self.ddp_backend)
17251725
self._n_gpu = 0
17261726
elif is_sagemaker_mp_enabled():

0 commit comments

Comments
 (0)