Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
73b13ac0
Unverified
Commit
73b13ac0
authored
Sep 13, 2023
by
Sourab Mangrulkar
Committed by
GitHub
Sep 13, 2023
Browse files
safeguard torch distributed check (#26056)
parent
12f043ea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+5
-1
No files found.
src/transformers/modeling_utils.py
View file @
73b13ac0
...
...
@@ -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
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment