gokaygokay commited on
Commit
67d5cbe
1 Parent(s): aa29b20
Files changed (1) hide show
  1. module/ip_adapter/utils.py +6 -1
module/ip_adapter/utils.py CHANGED
@@ -123,7 +123,12 @@ def load_adapter_to_pipe(
123
  attn_procs = init_attn_proc(unet, adapter_tokens, use_lcm, use_adaln)
124
  unet.set_attn_processor(attn_procs)
125
  adapter_modules = torch.nn.ModuleList(unet.attn_processors.values())
126
- missing, _ = adapter_modules.load_state_dict(state_dict["ip_adapter"], strict=False)
 
 
 
 
 
127
  if len(missing) > 0:
128
  raise ValueError(f"Missing keys in adapter_modules: {missing}")
129
 
 
123
  attn_procs = init_attn_proc(unet, adapter_tokens, use_lcm, use_adaln)
124
  unet.set_attn_processor(attn_procs)
125
  adapter_modules = torch.nn.ModuleList(unet.attn_processors.values())
126
+
127
+ # Filter out LoRA-related keys from the state dict
128
+ filtered_state_dict = {k: v for k, v in state_dict["ip_adapter"].items()
129
+ if not any(x in k for x in ['lora_A', 'lora_B'])}
130
+
131
+ missing, _ = adapter_modules.load_state_dict(filtered_state_dict, strict=False)
132
  if len(missing) > 0:
133
  raise ValueError(f"Missing keys in adapter_modules: {missing}")
134