-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Detect 2.0 vs 2.1 ZImageControlNetModel #12861
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
base: main
Are you sure you want to change the base?
Conversation
|
Will this also work for the new 8step and Tile-8step 2.1 variants? |
|
@iwr-redmond Yes the same detection should work as the Regarding new variants:
I will report back with test results later today, if you experience any issues in the meantime let me know. |



What does this PR do?
In
DIFFUSERS_DEFAULT_PIPELINE_PATHSz-image-turbo-controlnet-2.xis changed for separatez-image-turbo-controlnet-2.0andz-image-turbo-controlnet-2.1.z-image-turbo-controlnet-2.xis kept forCHECKPOINT_KEY_NAMES, there is no key difference between the 2 versions. The detection comes from another key and checking whether the weight is all zeros:torch.all(checkpoint["control_noise_refiner.0.before_proj.weight"] == 0.0). This works due tozero_modulewhenbefore_projis initialized - these layers remained untrained in 2.0. We also account for the possibility ofcontrol_noise_refinerbeing removed from the checkpoint as done in the Diffusers version.diffusers/src/diffusers/models/controlnets/controlnet_z_image.py
Line 343 in 55463f7
With PR:
controlnet = ZImageControlNetModel.from_single_file( hf_hub_download( "alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union-2.0", "Z-Image-Turbo-Fun-Controlnet-Union-2.0.safetensors", ), torch_dtype=torch.bfloat16, - config="hlky/Z-Image-Turbo-Fun-Controlnet-Union-2.0", )Passing
configis no longer required.Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.