Skip to content

Commit

Permalink
Switch to XLA instead of TPU (#3118)
Browse files Browse the repository at this point in the history
  • Loading branch information
SunMarc authored Sep 18, 2024
1 parent 521eb5b commit 4617be3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
2 changes: 1 addition & 1 deletion src/accelerate/launchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def train(*args):
if num_processes is None:
num_processes = 8

launcher = PrepareForLaunch(function, distributed_type="TPU")
launcher = PrepareForLaunch(function, distributed_type="XLA")
print(f"Launching a training on {num_processes} TPU cores.")
xmp.spawn(launcher, args=args, nprocs=num_processes, start_method="fork")
elif in_colab and get_gpu_info()[1] < 2:
Expand Down
25 changes: 0 additions & 25 deletions src/accelerate/utils/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,30 +503,6 @@ def build(self) -> torch.profiler.profile:
)


class DeprecatedFieldDescriptor:
"""
Descriptor for deprecated fields in an enum class.
Args:
field_name (`str`):
The name of the deprecated field.
replaced_with (`str`):
The name of the field that replaces the deprecated one.
"""

def __init__(self, field_name, replaced_with):
self.field_name = field_name
self.replaced_with = replaced_with

def __get__(self, instance, owner):
warnings.warn(
f"The `{self.field_name}` of `{owner}` is deprecated and will be removed in v1.0.0. "
f"Please use the `{self.replaced_with}` instead.",
FutureWarning,
)
return getattr(owner, self.replaced_with)


class DistributedType(str, enum.Enum):
"""
Represents a type of distributed environment.
Expand Down Expand Up @@ -556,7 +532,6 @@ class DistributedType(str, enum.Enum):
FSDP = "FSDP"
XLA = "XLA"
MEGATRON_LM = "MEGATRON_LM"
TPU = DeprecatedFieldDescriptor("TPU", "XLA")


class SageMakerDistributedType(str, enum.Enum):
Expand Down

0 comments on commit 4617be3

Please sign in to comment.