Skip to content

Commit d12531d

Browse files
committed
lora: only remove hooks that we add back
1 parent 4751d45 commit d12531d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/diffusers/loaders/lora_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ def _func_optionally_disable_offloading(_pipeline):
456456
logger.info(
457457
"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."
458458
)
459-
remove_hook_from_module(component, recurse=is_sequential_cpu_offload)
459+
if is_sequential_cpu_offload or is_model_cpu_offload:
460+
remove_hook_from_module(component, recurse=is_sequential_cpu_offload)
460461

461462
return (is_model_cpu_offload, is_sequential_cpu_offload)
462463

0 commit comments

Comments
 (0)