Fix: Z-Image LoRA detection for Kohya and ComfyUI formats#9007
Open
Pfannkuchensack wants to merge 1 commit intoinvoke-ai:mainfrom
Open
Fix: Z-Image LoRA detection for Kohya and ComfyUI formats#9007Pfannkuchensack wants to merge 1 commit intoinvoke-ai:mainfrom
Pfannkuchensack wants to merge 1 commit intoinvoke-ai:mainfrom
Conversation
Add support for Kohya-format Z-Image LoRAs (lora_unet__ prefix) by adding key detection and conversion to dot-notation module paths. Fix ComfyUI-format Z-Image LoRAs being misidentified as main models by ensuring LoRA-specific suffixes (including .alpha) are checked before Z-Image key matching in _has_z_image_keys().
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
Add support for Kohya-format Z-Image LoRAs (
lora_unet__prefix) by adding key detection and conversion to dot-notation module paths. Fix ComfyUI-format Z-Image LoRAs being misidentified as main models by ensuring LoRA-specific suffixes (including.alpha) are checked before Z-Image key matching in_has_z_image_keys().Related Issues / Discussions
https://discord.com/channels/1020123559063990373/1149506274971631688/1487673057400197180
QA Instructions
Test with two Z-Image LoRA files in different formats:
Kohya format (keys like
lora_unet__layers_0_attention_to_k.lora_down.weight):LoRA / LyCORIS / Z-Imagelayers.0.attention.to_k) and applied correctly during inferenceComfyUI format (keys like
diffusion_model.layers.0.attention.to_k.lora_down.weight):LoRA / LyCORIS / Z-Image(previously misidentified asMain / Checkpoint / Z-Image)Regression checks:
Main / Checkpoint / Z-ImageMerge Plan
Checklist
What's Newcopy (if doing a release after this PR)