-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(model-manager): add Z-Image LoRA/DoRA detection support #8709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(model-manager): add Z-Image LoRA/DoRA detection support #8709
Conversation
Override _validate_looks_like_lora in LoRA_LyCORIS_ZImage_Config to recognize Z-Image specific LoRA formats that use different key patterns than SD/SDXL LoRAs. Z-Image LoRAs (including DoRA format) use keys like: - diffusion_model.layers.X.attention.to_k.lora_down.weight - diffusion_model.layers.X.attention.to_k.dora_scale The base LyCORIS config only checked for lora_A.weight/lora_B.weight suffixes, missing the lora_down.weight/lora_up.weight and dora_scale patterns used by Z-Image LoRAs.
|
My Onetrainer trained loras install now but give error on gen. [2025-12-27 09:00:29,105]::[InvokeAI]::ERROR --> Error while invoking session 5c876236-38b2-4e92-a340-121b4c29df3b, invocation e84246fe-7d29-43e9-90bf-603e2e641ccb (z_image_text_encoder): Unsupported lora format: dict_keys(['to_k |
Two fixes for Z-Image LoRA support: 1. Override _validate_looks_like_lora in LoRA_LyCORIS_ZImage_Config to recognize Z-Image specific LoRA formats that use different key patterns than SD/SDXL LoRAs. Z-Image LoRAs use lora_down.weight/lora_up.weight and dora_scale suffixes instead of lora_A.weight/lora_B.weight. 2. Fix _group_by_layer in z_image_lora_conversion_utils.py to correctly group LoRA keys by layer name. The previous logic used rsplit with maxsplit=2 which incorrectly grouped keys like: - "to_k.alpha" -> layer "diffusion_model.layers.17.attention" - "lora_down.weight" -> layer "diffusion_model.layers.17.attention.to_k" Now uses suffix matching to ensure all keys for a layer are grouped together (alpha, dora_scale, lora_down.weight, lora_up.weight).
…Pfannkuchensack/InvokeAI into fix/z-image-lora-dora-detection
|
Can you try again with the now made changes? @nphSi |
That was fast 👍 - Works now. Thanks!! |
Summary
Fix Z-Image LoRA/DoRA model detection failing during installation.
Z-Image LoRAs use different key patterns than SD/SDXL LoRAs. The base
LoRA_LyCORIS_Config_Baseclass only checked for key suffixes likelora_A.weightandlora_B.weight, but Z-Image LoRAs (especially those in DoRA format) use:lora_down.weight/lora_up.weight(standard LoRA format)dora_scale(DoRA weight decomposition)This PR overrides
_validate_looks_like_lorainLoRA_LyCORIS_ZImage_Configto recognize Z-Image specific patterns:diffusion_model.layers.(Z-Image S3-DiT architecture)lora_down.weight,lora_up.weight,lora_A.weight,lora_B.weight, ordora_scaleRelated Issues / Discussions
Fixes installation of Z-Image LoRAs trained with DoRA (Weight-Decomposed Low-Rank Adaptation).
QA Instructions
diffusion_model.layers.X.attention.to_k.lora_down.weight)Merge Plan
Standard merge, no special considerations.
Checklist
What's Newcopy (if doing a release after this PR)