mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-02 19:21:31 +06:00
safeguard torch distributed check (#26056)
This commit is contained in:
parent
12f043eaea
commit
73b13ac099
@ -120,7 +120,11 @@ _init_weights = True
|
||||
|
||||
|
||||
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():
|
||||
|
Loading…
Reference in New Issue
Block a user