Skip to content

Commit e452ff1

Browse files
committed
up
1 parent 7fc53b5 commit e452ff1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/diffusers/loaders/lora_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@ def _func_optionally_disable_offloading(_pipeline):
442442
logger.info(
443443
"Accelerate hooks detected. Since you have called `load_lora_weights()`, the previous hooks will be first removed. Then the LoRA parameters will be loaded and the hooks will be applied again."
444444
)
445-
remove_hook_from_module(component, recurse=is_sequential_cpu_offload)
445+
if is_sequential_cpu_offload or is_model_cpu_offload:
446+
remove_hook_from_module(component, recurse=is_sequential_cpu_offload)
446447

447448
return (is_model_cpu_offload, is_sequential_cpu_offload)
448449

src/diffusers/loaders/textual_inversion.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,8 @@ def load_textual_inversion(
427427
logger.info(
428428
"Accelerate hooks detected. Since you have called `load_textual_inversion()`, the previous hooks will be first removed. Then the textual inversion parameters will be loaded and the hooks will be applied again."
429429
)
430-
remove_hook_from_module(component, recurse=is_sequential_cpu_offload)
430+
if is_sequential_cpu_offload or is_model_cpu_offload:
431+
remove_hook_from_module(component, recurse=is_sequential_cpu_offload)
431432

432433
# 7.2 save expected device and dtype
433434
device = text_encoder.device

0 commit comments

Comments
 (0)