fix(model_manager): prevent Z-Image LoRAs from being misclassified as main models#8754
Merged
lstein merged 4 commits intoinvoke-ai:mainfrom Jan 15, 2026
Merged
Conversation
… main models Z-Image LoRAs containing keys like `diffusion_model.context_refiner.*` were being incorrectly classified as main checkpoint models instead of LoRAs. This happened because the `_has_z_image_keys()` function checked for Z-Image specific keys (like `context_refiner`) without verifying if the file was actually a LoRA. Since main models have higher priority than LoRAs in the classification sort order, the incorrect main model classification would win. The fix adds detection of LoRA-specific weight suffixes (`.lora_down.weight`, `.lora_up.weight`, `.lora_A.weight`, `.lora_B.weight`, `.dora_scale`) and returns False if any are found, ensuring LoRAs are correctly classified.
Collaborator
|
Does this reclassify existing models if somebody reidentifies? |
Collaborator
Author
|
This will fix any Lora that got identifies as Model right if reidentifies again. |
JPPhoto
requested changes
Jan 11, 2026
JPPhoto
requested changes
Jan 14, 2026
Return True directly when a Z-Image key is found instead of using an intermediate variable.
JPPhoto
approved these changes
Jan 15, 2026
lstein
pushed a commit
to lstein/InvokeAI
that referenced
this pull request
Jan 23, 2026
… main models (invoke-ai#8754) * fix(model_manager): prevent Z-Image LoRAs from being misclassified as main models Z-Image LoRAs containing keys like `diffusion_model.context_refiner.*` were being incorrectly classified as main checkpoint models instead of LoRAs. This happened because the `_has_z_image_keys()` function checked for Z-Image specific keys (like `context_refiner`) without verifying if the file was actually a LoRA. Since main models have higher priority than LoRAs in the classification sort order, the incorrect main model classification would win. The fix adds detection of LoRA-specific weight suffixes (`.lora_down.weight`, `.lora_up.weight`, `.lora_A.weight`, `.lora_B.weight`, `.dora_scale`) and returns False if any are found, ensuring LoRAs are correctly classified. * refactor(mm): simplify _has_z_image_keys with early return Return True directly when a Z-Image key is found instead of using an intermediate variable.
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
Z-Image LoRAs containing keys like
diffusion_model.context_refiner.*were being incorrectly classified as main checkpoint models instead of LoRAs. This happened because the_has_z_image_keys()function checked for Z-Image specific keys (likecontext_refiner) without verifying if the file was actually a LoRA.Since main models have higher priority than LoRAs in the classification sort order, the incorrect main model classification would win.
The fix adds detection of LoRA-specific weight suffixes (
.lora_down.weight,.lora_up.weight,.lora_A.weight,.lora_B.weight,.dora_scale) and returns False if any are found, ensuring LoRAs are correctly classified.Related Issues / Discussions
#8707
QA Instructions
diffusion_model.context_refiner.*ordiffusion_model.layers.*keys)LoRAtype withz-imagebase andlycorisformatMaintype withz-imagebaseMerge Plan
Standard merge, no special considerations.
Checklist
What's Newcopy (if doing a release after this PR)