[bug]: Qwen-Image LoRAs with `diffusion_model.` or `base_model.model.` key prefixes are not identified and apply to no layer
I maintainer di solito rispondono entro 2 giorni
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python, pytorch
- Ambito
- backend, machine-learning
Direzione di ricerca
Start in invokeai/backend/model_manager/configs/lora.py at LoRA_LyCORIS_QwenImage_Config._validate_looks_like_lora and accept diffusion_model. and base_model.model. prefixes. Then in invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:124 update _convert_diffusers_format to strip them like the Z-Image converter. Run the issue's reproduction script; done when identified as lora and 0 layers missing.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue for this problem?
- I have searched the existing issues
Install method
Manual (dev checkout)
Operating system
Windows
GPU vendor
Not GPU-specific (reproduced on CPU)
GPU model
No response
GPU VRAM
No response
Version number
main at 0ddc9df91b
What happened
Qwen-Image LoRAs whose keys carry a diffusion_model. prefix (the ComfyUI layout) or the raw PEFT prefix base_model.model. (adapter_model.safetensors) install as Unknown. With the base forced to Qwen-Image, every layer keeps its prefix and resolves to no module, so the LoRA has no effect.
- Identification:
LoRA_LyCORIS_QwenImage_Config._validate_looks_like_lora(invokeai/backend/model_manager/configs/lora.py) accepts only keys starting withtransformer_blocks.,transformer.transformer_blocks.orlora_unet_transformer_blocks_. - Conversion:
_convert_diffusers_format(invokeai/backend/patches/lora_conversions/qwen_image_lora_conversion_utils.py:124) strips onlytransformer..
This is the most common Qwen-Image layout on Hugging Face. Of 1,596 safetensors files with Qwen-Image block keys in adapter repos of Qwen/Qwen-Image, Qwen-Image-Edit-2509, Qwen-Image-Edit-2511 and Qwen-Image-2512, 1,051 use diffusion_model. and 7 use base_model.model.. Examples: autoweeb/Qwen-Image-Edit-2509-Photo-to-Anime, lilylilith/AnyPose, Wuli-art/Qwen-Image-2512-Turbo-LoRA-2-Steps.
What you expected to happen
Both prefixes are accepted by identification and stripped by the converter, as the Z-Image and Anima converters already do for theirs.
How to reproduce the problem
With Qwen-Image-Edit-2509-Photo-to-Anime_000001000.safetensors from the first example repo:
import json
import torch
from diffusers import QwenImageTransformer2DModel
from safetensors.torch import load_file
import invokeai.backend.model_manager.load # noqa: F401
from invokeai.backend.model_manager.configs.factory import ModelConfigFactory
from invokeai.backend.patches.lora_conversions.qwen_image_lora_conversion_utils import lora_model_from_qwen_image_state_dict
path = "Qwen-Image-Edit-2509-Photo-to-Anime_000001000.safetensors"
print("identified as:", ModelConfigFactory.from_model_on_disk(path).config.type.value)
patch = lora_model_from_qwen_image_state_dict(load_file(path), alpha=None)
with torch.device("meta"):
model = QwenImageTransformer2DModel() # Qwen-Image geometry
modules = dict(model.named_modules())
missing = [k for k in patch.layers if k.removeprefix("lora_transformer-") not in modules]
print(f"{len(missing)} of {len(patch.layers)} layers resolve to no module, e.g. {missing[0]}")
Output on main:
identified as: unknown
840 of 840 layers resolve to no module, e.g. lora_transformer-diffusion_model.transformer_blocks.0.attn.add_k_proj
Additional context
Some base_model.model. files also carry PEFT DoRA magnitudes as bare lora_magnitude_vector keys, which then fail to load as described in #9558.
Found while checking real Qwen-Image LoRAs from Hugging Face against main (identification, LoRALoader, and LayerPatcher module resolution on the Qwen-Image transformer).
Discord username
No response
- Lingua principale
- TypeScript
- Stelle
- 28.9k
- Fork
- 3.1k
- Merge medio
- 3g 17h
- PR unite (30g)
- 188
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di invoke-ai/InvokeAI
-
[bug]: upload_image resize_to is documented as a stringified tuple, but only a JSON object with width and height is acceptedForse già presa @GuilhermeAAV l’ha presa 2 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
invoke-ai/InvokeAI#10047 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
[bug]: Anima kohya LoRAs: layers outside the DiT blocks are not appliedForse già presa @guishiw l’ha presa 1 giorno fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
invoke-ai/InvokeAI#10028 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[bug]: FLUX final-layer modulation LoRA layer is not converted (FLUX.1 diffusers: load fails, FLUX.2 BFL: layer skipped)Forse già presa @Pfannkuchensack l’ha presa 2 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
invoke-ai/InvokeAI#10022 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
[enhancement]: Bump PyPatchMatch to latestForse già presa @dunkeroni l’ha presa 14 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
invoke-ai/InvokeAI#9826 · 2 reazioni · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di invoke-ai/InvokeAI
Issue simili
-
b:minor bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
software-mansion/argent#1698 ·
I maintainer di solito rispondono entro 1 giorno
-
e2e-failure ready-to-code
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
redhat-developer/rhdh-plugin-export-overlays#4624 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
better-auth/better-auth#12132 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
automation missing-model model-sync provider:tinfoil
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anomalyco/models.dev#12053 ·
I maintainer di solito rispondono entro 1 giorno
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
hurttlocker/o8#5112 ·