fix(model_manager): prevent Z-Image LoRAs from being misclassified as main models #8754
+24
−3
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)