|
30 | 30 | IPAdapterPlusImageProjection, |
31 | 31 | MultiIPAdapterImageProjection, |
32 | 32 | ) |
33 | | -from ..models.modeling_utils import load_model_dict_into_meta, load_state_dict |
| 33 | +from ..models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT, load_model_dict_into_meta, load_state_dict |
34 | 34 | from ..utils import ( |
35 | 35 | USE_PEFT_BACKEND, |
36 | 36 | _get_model_file, |
@@ -143,7 +143,7 @@ def load_attn_procs(self, pretrained_model_name_or_path_or_dict: Union[str, Dict |
143 | 143 | adapter_name = kwargs.pop("adapter_name", None) |
144 | 144 | _pipeline = kwargs.pop("_pipeline", None) |
145 | 145 | network_alphas = kwargs.pop("network_alphas", None) |
146 | | - low_cpu_mem_usage = kwargs.pop("low_cpu_mem_usage", False) |
| 146 | + low_cpu_mem_usage = kwargs.pop("low_cpu_mem_usage", _LOW_CPU_MEM_USAGE_DEFAULT) |
147 | 147 | allow_pickle = False |
148 | 148 |
|
149 | 149 | if low_cpu_mem_usage and is_peft_version("<=", "0.13.0"): |
@@ -540,7 +540,7 @@ def _get_custom_diffusion_state_dict(self): |
540 | 540 |
|
541 | 541 | return state_dict |
542 | 542 |
|
543 | | - def _convert_ip_adapter_image_proj_to_diffusers(self, state_dict, low_cpu_mem_usage=False): |
| 543 | + def _convert_ip_adapter_image_proj_to_diffusers(self, state_dict, low_cpu_mem_usage=_LOW_CPU_MEM_USAGE_DEFAULT): |
544 | 544 | if low_cpu_mem_usage: |
545 | 545 | if is_accelerate_available(): |
546 | 546 | from accelerate import init_empty_weights |
@@ -758,7 +758,7 @@ def _convert_ip_adapter_image_proj_to_diffusers(self, state_dict, low_cpu_mem_us |
758 | 758 |
|
759 | 759 | return image_projection |
760 | 760 |
|
761 | | - def _convert_ip_adapter_attn_to_diffusers(self, state_dicts, low_cpu_mem_usage=False): |
| 761 | + def _convert_ip_adapter_attn_to_diffusers(self, state_dicts, low_cpu_mem_usage=_LOW_CPU_MEM_USAGE_DEFAULT): |
762 | 762 | from ..models.attention_processor import ( |
763 | 763 | IPAdapterAttnProcessor, |
764 | 764 | IPAdapterAttnProcessor2_0, |
@@ -854,7 +854,7 @@ def _convert_ip_adapter_attn_to_diffusers(self, state_dicts, low_cpu_mem_usage=F |
854 | 854 |
|
855 | 855 | return attn_procs |
856 | 856 |
|
857 | | - def _load_ip_adapter_weights(self, state_dicts, low_cpu_mem_usage=False): |
| 857 | + def _load_ip_adapter_weights(self, state_dicts, low_cpu_mem_usage=_LOW_CPU_MEM_USAGE_DEFAULT): |
858 | 858 | if not isinstance(state_dicts, list): |
859 | 859 | state_dicts = [state_dicts] |
860 | 860 |
|
|
0 commit comments