Unverified Commit aa4afa67 authored by Madhava Jay's avatar Madhava Jay Committed by GitHub
Browse files

Fixed issue where ACCELERATE_USE_CPU="False" results in bool(True) (#24907)

- This results in cpu mode on Apple Silicon mps
parent 243b2ea3
...@@ -53,6 +53,7 @@ from .utils import ( ...@@ -53,6 +53,7 @@ from .utils import (
logging, logging,
requires_backends, requires_backends,
) )
from .utils.generic import strtobool
from .utils.import_utils import is_optimum_neuron_available from .utils.import_utils import is_optimum_neuron_available
...@@ -1720,7 +1721,7 @@ class TrainingArguments: ...@@ -1720,7 +1721,7 @@ class TrainingArguments:
self.distributed_state = None self.distributed_state = None
if not self.use_ipex and "ACCELERATE_USE_IPEX" not in os.environ: if not self.use_ipex and "ACCELERATE_USE_IPEX" not in os.environ:
os.environ["ACCELERATE_USE_IPEX"] = "false" os.environ["ACCELERATE_USE_IPEX"] = "false"
if self.use_cpu or os.environ.get("ACCELERATE_USE_CPU", False): if self.use_cpu or strtobool(os.environ.get("ACCELERATE_USE_CPU", "False")):
self.distributed_state = PartialState(cpu=True, backend=self.ddp_backend) self.distributed_state = PartialState(cpu=True, backend=self.ddp_backend)
self._n_gpu = 0 self._n_gpu = 0
elif is_sagemaker_mp_enabled(): elif is_sagemaker_mp_enabled():
......
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