-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(model_manager): prevent Z-Image LoRAs from being misclassified as main models #8754
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): prevent Z-Image LoRAs from being misclassified as main models #8754
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.
|
Does this reclassify existing models if somebody reidentifies? |
|
This will fix any Lora that got identifies as Model right if reidentifies again. |
lstein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wasn't clear. I think you should remove has_z_image_keys and should return True if found, else return False. That variable didn't add much since there's no block below that in the code that depends on its value.
Return True directly when a Z-Image key is found instead of using an intermediate variable.
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)