Conversation
ComfyUI and ai-toolkit Qwen-Image-2.1 LoRAs target the fused SwiGLU `img_mlp.gate_up` layer, which diffusers keeps as separate `gate_layer` and `proj` layers. Those keys were dropped as unexpected, so the LoRA loaded without its MLP update. Split them into the two layers, gate rows first, as the full-checkpoint converter does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 of 10 tasks
Contributor
|
Hi @dkackman, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice. Once the PR links an issue (or gets the |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #14937
ComfyUI and ai-toolkit LoRAs for Qwen-Image-2.1 target the fused SwiGLU
img_mlp.gate_uplayer. diffusers keeps that layer as two separate layers,img_mlp.gate_layerandimg_mlp.proj, so the converter passed thegate_upkeys through, PEFT dropped them as unexpected keys, and the LoRA loaded without its MLP update and without any error.This PR splits those LoRAs into the two layers when they're loaded, gate rows first, in the same order
convert_qwen_image21_transformer_checkpoint_to_diffusersuses for full checkpoints.lora_Ais shared andlora_Bis split by rows, so the split is lossless. Nothing changes for the original Qwen-Image, which has nogate_uplayer.Checked against real files: converting ML-Intern-lab's fused doodle-in LoRA gives exactly the pre-split file they publish. The Outpaint-v2, grainscape and AnyAngle LoRAs map fully onto the 2.1 model's layers, with no keys dropped.
Related: #14933. That PR fixes
.alphabeing dropped from lora_A/lora_B checkpoints, which is a separate bug. Both PRs edit_convert_non_diffusers_qwen_lora_to_diffusers, so whichever merges second needs a small rebase.Self-review notes
I ran the
self-reviewskill. It found no blocking issues. I removed the dead code it flagged (an unreachableelseand a redundant early return). Left for review:_split_qwen_image21_fused_gate_up_lorahas a single caller. I kept it separate so the 2.1-specific logic and its docstring stay out of the shared Qwen converter, but I'm happy to inline it..alphain lora_A/lora_B checkpoints is still dropped. That's deliberate: [LoRA] apply.alphain lora_A/lora_B Qwen-Image LoRAs #14933 handles it.Before submitting
self-reviewskill on the diff?Who can review?
@sayakpaul
🤖 Generated with Claude Code