Skip to content

Commit b70d147

Browse files
elismasilva蒋硕
authored and
蒋硕
committed
Fix for use_safetensors parameters, allow use of parameter on loading submodels (huggingface#9576) (huggingface#9587)
* Fix for use_safetensors parameters, allow use of parameter on loading submodels (huggingface#9576)
1 parent c769aba commit b70d147

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/diffusers/pipelines/pipeline_loading_utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ def load_sub_model(
601601
variant: str,
602602
low_cpu_mem_usage: bool,
603603
cached_folder: Union[str, os.PathLike],
604+
use_safetensors: bool,
604605
):
605606
"""Helper method to load the module `name` from `library_name` and `class_name`"""
606607

@@ -670,6 +671,7 @@ def load_sub_model(
670671
loading_kwargs["offload_folder"] = offload_folder
671672
loading_kwargs["offload_state_dict"] = offload_state_dict
672673
loading_kwargs["variant"] = model_variants.pop(name, None)
674+
loading_kwargs["use_safetensors"] = use_safetensors
673675

674676
if from_flax:
675677
loading_kwargs["from_flax"] = True

src/diffusers/pipelines/pipeline_utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,7 @@ def load_module(name, value):
905905
variant=variant,
906906
low_cpu_mem_usage=low_cpu_mem_usage,
907907
cached_folder=cached_folder,
908+
use_safetensors=use_safetensors,
908909
)
909910
logger.info(
910911
f"Loaded {name} as {class_name} from `{name}` subfolder of {pretrained_model_name_or_path}."

0 commit comments

Comments
 (0)