enable xla fsdp (#32048)

* enable xla fsdp

* add acceleration version check for xla fsdp
This commit is contained in:
append-only 2024-08-07 17:28:17 +08:00 committed by GitHub
parent 7ad784ae9d
commit 46d09af4fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1902,7 +1902,7 @@ class TrainingArguments:
warnings.warn("`--xla_fsdp_grad_ckpt` is useful only when `--xla` is set to true.")
# accelerate integration for FSDP
if len(self.fsdp) > 0 and not self.fsdp_config["xla"]:
if len(self.fsdp) > 0 and is_accelerate_available("0.28.0"):
os.environ["ACCELERATE_USE_FSDP"] = "true"
from accelerate.utils.constants import (
FSDP_AUTO_WRAP_POLICY,