Skip to content

Fix: Z-Image LoRA detection for Kohya and ComfyUI formats#9007

Open
Pfannkuchensack wants to merge 1 commit intoinvoke-ai:mainfrom
Pfannkuchensack:fix/z-image-kohya-lora-detection
Open

Fix: Z-Image LoRA detection for Kohya and ComfyUI formats#9007
Pfannkuchensack wants to merge 1 commit intoinvoke-ai:mainfrom
Pfannkuchensack:fix/z-image-kohya-lora-detection

Conversation

@Pfannkuchensack
Copy link
Copy Markdown
Collaborator

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):

  • Should be auto-detected as LoRA / LyCORIS / Z-Image
  • Keys should be converted to dot-notation (layers.0.attention.to_k) and applied correctly during inference

ComfyUI format (keys like diffusion_model.layers.0.attention.to_k.lora_down.weight):

  • Should be auto-detected as LoRA / LyCORIS / Z-Image (previously misidentified as Main / Checkpoint / Z-Image)
  • Should apply correctly during inference

Regression checks:

  • Z-Image main model checkpoints should still be detected as Main / Checkpoint / Z-Image
  • FLUX, SD1, SD2, SDXL LoRA detection should be unaffected

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

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().
@github-actions github-actions bot added python PRs that change python files backend PRs that change backend files labels Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend PRs that change backend files python PRs that change python files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant