From d12531ddf7ac7ab9eff5ec4d24f4b54d43f98cb9 Mon Sep 17 00:00:00 2001 From: yiyixuxu Date: Sun, 22 Jun 2025 12:32:04 +0200 Subject: [PATCH] lora: only remove hooks that we add back --- src/diffusers/loaders/lora_base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/diffusers/loaders/lora_base.py b/src/diffusers/loaders/lora_base.py index 850c4b2b4b..08a64c3487 100644 --- a/src/diffusers/loaders/lora_base.py +++ b/src/diffusers/loaders/lora_base.py @@ -456,7 +456,8 @@ def _func_optionally_disable_offloading(_pipeline): logger.info( "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." ) - remove_hook_from_module(component, recurse=is_sequential_cpu_offload) + if is_sequential_cpu_offload or is_model_cpu_offload: + remove_hook_from_module(component, recurse=is_sequential_cpu_offload) return (is_model_cpu_offload, is_sequential_cpu_offload)