Disable quick init for deepspeed (#32066)

Disable via deepspeed
This commit is contained in:
Zach Mueller 2024-07-19 08:58:53 -04:00 committed by GitHub
parent 89575b567e
commit 62aa270f2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
if the model explicitly disables it, then by ensuring that the state dict keys
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:
return False
if is_deepspeed_zero3_enabled():
return False
# Some models explicitly do not support param buffer assignment
if not getattr(model_to_load, "_supports_param_buffer_assignment", True):
logger.debug(