Skip to content

Commit 17960cc

Browse files
feat: auto-detect and fuse QKV for original PEFT adapters
1 parent 26ec30e commit 17960cc

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/diffusers/loaders/peft.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ def load_lora_adapter(
225225
if is_sai_sd_control_lora:
226226
state_dict = convert_sai_sd_control_lora_state_dict_to_peft(state_dict)
227227

228+
# Auto-detect if the incoming state_dict expects fused QKV projections
229+
# and fuse them in the model if the model supports it.
230+
has_fused_qkv = any("to_qkv" in k for k in state_dict.keys())
231+
if has_fused_qkv and hasattr(self, "fuse_qkv_projections"):
232+
self.fuse_qkv_projections()
233+
228234
rank = {}
229235
for key, val in state_dict.items():
230236
# Cannot figure out rank from lora layers that don't have at least 2 dimensions.

0 commit comments

Comments
 (0)