Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions optimum/habana/accelerate/accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,7 @@ def __init__(
if os.environ.get("ACCELERATE_USE_FSDP", "false") == "true" or isinstance(
fsdp_plugin, GaudiFullyShardedDataParallelPlugin
):
import importlib.metadata

torch_version = importlib.metadata.version("torch")
torch_version = torch_version[5:]
if is_torch_version("<", FSDP_PYTORCH_VERSION + torch_version):
if is_torch_version("<", FSDP_PYTORCH_VERSION):
raise ValueError(f"FSDP requires PyTorch >= {FSDP_PYTORCH_VERSION}")

if fsdp_plugin is None: # init from env variables
Expand All @@ -195,6 +191,7 @@ def __init__(
self.autocast_handler = None
self.profile_handler = None
self.has_lomo_optimizer = False
self.has_fp8_handler=False

if kwargs_handlers is not None:
for handler in kwargs_handlers:
Expand Down
4 changes: 2 additions & 2 deletions optimum/habana/accelerate/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def __init__(
self.__dict__.update(GaudiPartialState._shared_state)
self._check_initialized(mixed_precision, cpu)
if not self.initialized:
self.deepspeed_plugin = None
self.deepspeed_plugins = None
self.use_ipex = None
mixed_precision = (
parse_choice_from_env("ACCELERATE_MIXED_PRECISION", "no")
Expand All @@ -197,7 +197,7 @@ def __init__(
"no" if self.distributed_type == GaudiDistributedType.DEEPSPEED else mixed_precision
)
if os.environ.get("ACCELERATE_USE_DEEPSPEED", "false") == "true" and not cpu:
self.deepspeed_plugin = deepspeed_plugin
self.deepspeed_plugins = deepspeed_plugin
if os.environ.get("ACCELERATE_USE_FSDP", "false") == "true" and not cpu:
if self._mixed_precision != "no":
fsdp_plugin.set_mixed_precision(self._mixed_precision)
Expand Down