-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Support latents_mean and latents_std #7132
Conversation
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.
Thanks a lot for the PR! Looks good, but we should leave other things un-touched in this PR, if there is some issue we a separate PR would be better.
@@ -1611,6 +1611,21 @@ def __call__( | |||
self.upcast_vae() | |||
latents = latents.to(next(iter(self.vae.post_quant_conv.parameters())).dtype) | |||
|
|||
# unscale/denormalize the latents |
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.
# unscale/denormalize the latents | |
# unscale/denormalize the latents |
|
||
# cast back to fp16 if needed | ||
if needs_upcasting: | ||
self.vae.to(dtype=torch.float16) | ||
else: | ||
return StableDiffusionXLPipelineOutput(images=latents) | ||
image = latents |
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.
why is this changed?
|
||
# cast back to fp16 if needed | ||
if needs_upcasting: | ||
self.vae.to(dtype=torch.float16) | ||
else: | ||
image = latents | ||
return StableDiffusionXLPipelineOutput(images=image) |
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.
same comment as above ?
agree with @patil-suraj here :) |
Fixed. @patil-suraj @yiyixuxu |
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. |
src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py
Outdated
Show resolved
Hide resolved
@haofanwang hey I fixed a mistake here #7132 (comment) but now the quality test fail again |
Sure. |
@yiyixuxu Formatted, pass my local check. |
As title.
This PR supports latents_mean and latents_std in the decoding stage of VAE as done in pipeline_stable_diffusion_xl.py to make the pipeline compatible to models like playgroundai/playground-v2.5-1024px-aesthetic that set latents_mean and latents_std in config. For now, all other pipelines lead to grey image except for pipeline_stable_diffusion_xl.py.
Tested locally.