Unverified Commit 73b13ac0 authored by Sourab Mangrulkar's avatar Sourab Mangrulkar Committed by GitHub
Browse files

safeguard torch distributed check (#26056)

parent 12f043ea
...@@ -120,7 +120,11 @@ _init_weights = True ...@@ -120,7 +120,11 @@ _init_weights = True
def is_fsdp_enabled(): def is_fsdp_enabled():
return torch.distributed.is_initialized() and strtobool(os.environ.get("ACCELERATE_USE_FSDP", "False")) == 1 return (
torch.distributed.is_available()
and torch.distributed.is_initialized()
and strtobool(os.environ.get("ACCELERATE_USE_FSDP", "False")) == 1
)
def is_fsdp_enabled_and_dist_rank_0(): def is_fsdp_enabled_and_dist_rank_0():
......
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