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
62aa270f
Unverified
Commit
62aa270f
authored
Jul 19, 2024
by
Zach Mueller
Committed by
GitHub
Jul 19, 2024
Browse files
Disable quick init for deepspeed (#32066)
Disable via deepspeed
parent
89575b56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+5
-0
No files found.
src/transformers/modeling_utils.py
View file @
62aa270f
...
@@ -344,10 +344,15 @@ def check_support_param_buffer_assignment(model_to_load, state_dict, start_prefi
...
@@ -344,10 +344,15 @@ def check_support_param_buffer_assignment(model_to_load, state_dict, start_prefi
as when loading in empty weights) by first checking
as when loading in empty weights) by first checking
if the model explicitly disables it, then by ensuring that the state dict keys
if the model explicitly disables it, then by ensuring that the state dict keys
are a subset of the model's parameters.
are a subset of the model's parameters.
Note: We fully disable this if we are using `deepspeed`
"""
"""
if
len
([
key
for
key
in
state_dict
if
key
.
startswith
(
start_prefix
)])
==
0
:
if
len
([
key
for
key
in
state_dict
if
key
.
startswith
(
start_prefix
)])
==
0
:
return
False
return
False
if
is_deepspeed_zero3_enabled
():
return
False
# Some models explicitly do not support param buffer assignment
# Some models explicitly do not support param buffer assignment
if
not
getattr
(
model_to_load
,
"_supports_param_buffer_assignment"
,
True
):
if
not
getattr
(
model_to_load
,
"_supports_param_buffer_assignment"
,
True
):
logger
.
debug
(
logger
.
debug
(
...
...
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