-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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 configuring VAE from single file mixin #6950
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Agree with @patrickvonplaten's 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.
hey thanks!
feel free to merge if @sayakpaul and @patrickvonplaten gives ok
I have a few questions (they might be very obvious)
- is it that the only way to load it correctly we would need to pass the
scale_factor
manually?
vae = AutoencoderKL.from_single_file("https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/blob/main/sdxl.vae.safetensors", scaling_factor=0.13025)
- is it not possible to infer the correct config based on the checkpoint in
infer_original_config_file
?
I think it's because we cannot assume that the scaling factor will always be present in the single-file checkpoint format. |
@sayakpaul I'm just wondering if it's able to know it's sdxl and return correct config URL instead |
also which one is correct config file for this vae, is it this? https://github.com/Stability-AI/generative-models/blob/main/configs/inference/sd_xl_base.yaml |
I think we can diff the state_dicts between SD 1.5, SD 2 and SDXL to see if there are unique keys for the model type that we could use to infer the config. Essentially in this case, we only have the VAE checkpoint state dict to make our guess. For the pipelines calling I can open a follow up PR to look into it. |
What does this PR do?
The scaling factor isn't correctly set when calling
AutoencoderKL.from_single_file
for SDXL models. It defaults to the SD scaling factor, leading to a washed out effect on the final image.Additionally SD.Next uses the
config_file
argument to pass in the path to the original config file, rather than theoriginal_config_file
argument. This is missing in the current Mixin.This PR:
scaling_factor
from the VAESingleFileMixinAutoencoderKL.from_single_file
can accept aconfig_file
argument as well.Fixes # (issue)
#6923
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
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.