Skip to content

feat: auto-detect and fuse QKV for original PEFT adapters#14105

Open
Saurav-Gupta-9741 wants to merge 1 commit into
huggingface:mainfrom
Saurav-Gupta-9741:support-fused-peft-adapters
Open

feat: auto-detect and fuse QKV for original PEFT adapters#14105
Saurav-Gupta-9741 wants to merge 1 commit into
huggingface:mainfrom
Saurav-Gupta-9741:support-fused-peft-adapters

Conversation

@Saurav-Gupta-9741

Copy link
Copy Markdown

Fixes #14002
Hi @dg845 Sir! I saw your comment regarding the lack of support for loading generalized, original-checkpoint PEFT adapters without relying on conversion logic.
To solve this, I added dynamic auto-detection to PeftAdapterMixin.load_lora_adapter. When an adapter is passed in (like DoRA, IA3, or standard LoRA), the code scans the state dictionary. If it expects a fused projection (e.g., to_qkv), it intercepts the load, checks if the model supports fusion, and automatically runs self.fuse_qkv_projections().
This guarantees that the Diffusers checkpoint weights natively coincide with the PEFT weights, allowing peft to inject it seamlessly without shape mismatch errors or giant conversion scripts!
I ran the tests/lora suite and locally tested a mock fused adapter to verify that the PyTorch shapes align perfectly after the interception. Let me know what you think!
Looking forward for your Response

@github-actions github-actions Bot added size/S PR with diff < 50 LOC fixes-issue lora and removed size/S PR with diff < 50 LOC fixes-issue labels Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Original Checkpoint-Compatible PEFT Adapters

1 participant