Repository navigation
fix(qwen-image): identify LyCORIS LoRA layouts and group dotted LoKr and LoHa keys - #10189
Merged
Pfannkuchensack merged 5 commits intoNov 12, 2026
Conversation
…and LoHa keys Recognize lycoris_transformer_blocks_ and lora_transformer_transformer_blocks_ files by Qwen-only modules, and stop FLUX claiming them. Group dotted LoKr and LoHa keys by module path and apply LyCORIS scalars. Closes invoke-ai#10020
joshistoast
requested changes
Nov 8, 2026
…ris-layouts # Conflicts: # invokeai/backend/model_manager/configs/lora.py
…ris-layouts # Conflicts: # docs/src/content/docs/Users Guide/03.Models/Local Models/qwen-image.mdx # invokeai/backend/patches/lora_conversions/qwen_image_lora_constants.py # invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py # tests/backend/patches/lora_conversions/test_qwen_image_lora_conversion_utils.py
joshistoast
approved these changes
Nov 11, 2026
6 of 7 tasks
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.
Summary
Real Qwen-Image LyCORIS files did not work:
lycoris_transformer_blocks_…(LoKr, 43 files in 6 Hugging Face repos) installed as an unknown model.lora_transformer_transformer_blocks_…(ai-toolkit LoHa) installed as a FLUX LoRA.Unsupported lora format, because grouping cut inside the module path.Now:
img_mod,txt_mod,img_mlp,txt_mlp), so FLUX files with the same spelling stay FLUX.flux_format_from_state_dictno longer claims a file with such a module.scalaris applied. It is folded into the layer before key normalization, for LoKr, LoHa and plain LoRA.Related Issues / Discussions
Closes #10020
#10184 touches the same converter, constants, test file and
qwen-image.mdx. The two do not depend on each other, but whichever lands second needs a rebase.QA Instructions
Checks run:
uv run --no-sync pytest -n 4 tests/backend/patches tests/backend/model_manager/configs tests/model_identification: 1949 passed, 25 skipped (CPU).Real files:
lycoris_transformer_blocks_LoKr files identify as Qwen-Image and convert to 720 layers.mikaelh's Minecraft LoKr) installed and generated through the server on an RTX 4090. At a fixed seed, weight 1 against weight 0 gives 12.93 dB PSNR, so it takes effect.To reproduce: install a Qwen-Image LoKr whose keys start with
lycoris_transformer_blocks_. It should install as Qwen-Image and change the image at weight 1.Not run:
Review
Resolved during review:
scalarwas only handled for LoKr and LoHa; it now also applies to plain LoRA layers.dora_scale, such asThatDustyGuy/QwenImage-PersonalLoRA, were identified as Qwen-Image but failed at generation withKeyError: 'lora_up.weight'. With fix(lora): handle DoRA magnitudes on LoKr and LoHa layers #10075 merged into this branch, the shared layer factory applies them as plain LoHa and LoKr without the magnitudes. The conversion tests now keepdora_scalein the ai-toolkit LoHa header and cover dotted LoHa and LoKr with it; with DoRA dispatched first again, all three fail. The family page says the magnitudes are skipped.Remaining limitations:
lycoris_file stays unknown, and alora_transformer_transformer_blocks_file stays FLUX.Compatibility / Rollout
No migration. Identification only runs at install, so a file already installed as FLUX or unknown keeps that record until it is reinstalled.
Checklist
What's Newcopy (if doing a release after this PR)Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.