Skip to content
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

bugfix: updated scaling factor for SDXL #300

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion python_coreml_stable_diffusion/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,14 @@ def run_safety_checker(self, image):
return image, has_nsfw_concept

def decode_latents(self, latents):
latents = 1 / 0.18215 * latents

if self.xl:
scaling_factor =0.13025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
scaling_factor =0.13025
scaling_factor = 0.13025

else:
scaling_factor = 0.18215

latents = 1 / scaling_factor * latents

dtype = self.vae_decoder.expected_inputs['z']['dtype']
image = self.vae_decoder(z=latents.astype(dtype))["image"]
image = np.clip(image / 2 + 0.5, 0, 1)
Expand Down