Compare commits

...

9 Commits

Author SHA1 Message Date
Dhruv Nair
f58d01f83f Merge branch 'main' into introduce-cosxl-arg-ip2p 2024-04-16 22:05:29 +05:30
Sayak Paul
d04fd1a805 Merge branch 'main' into introduce-cosxl-arg-ip2p 2024-04-15 09:33:15 +05:30
Sayak Paul
5cf81bf87c Merge branch 'main' into introduce-cosxl-arg-ip2p 2024-04-15 08:32:35 +05:30
sayakpaul
c684039389 reflect drhuv's comments. 2024-04-13 13:02:30 +05:30
Sayak Paul
f874d9ac18 Merge branch 'main' into introduce-cosxl-arg-ip2p 2024-04-13 11:48:07 +05:30
sayakpaul
56ad342f35 remove redundant logic. 2024-04-13 11:47:39 +05:30
sayakpaul
c8f17c2ab4 doc 2024-04-12 12:54:41 +05:30
sayakpaul
e71154acc6 Empty-Commit
Co-authored-by: Yiyi Xu <yixu310@gmail.com>
2024-04-12 12:53:35 +05:30
sayakpaul
8d267b5c50 is_cosxl_edit arg in SDXL ip2p. 2024-04-12 12:50:03 +05:30

View File

@@ -169,6 +169,8 @@ class StableDiffusionXLInstructPix2PixPipeline(
Whether to use the [invisible_watermark library](https://github.com/ShieldMnt/invisible-watermark/) to
watermark output images. If not defined, it will default to True if the package is installed, otherwise no
watermarker will be used.
is_cosxl_edit (`bool`, *optional*):
When set the image latents are scaled.
"""
model_cpu_offload_seq = "text_encoder->text_encoder_2->unet->vae"
@@ -185,6 +187,7 @@ class StableDiffusionXLInstructPix2PixPipeline(
scheduler: KarrasDiffusionSchedulers,
force_zeros_for_empty_prompt: bool = True,
add_watermarker: Optional[bool] = None,
is_cosxl_edit: Optional[bool] = False,
):
super().__init__()
@@ -201,6 +204,7 @@ class StableDiffusionXLInstructPix2PixPipeline(
self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1)
self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor)
self.default_sample_size = self.unet.config.sample_size
self.is_cosxl_edit = is_cosxl_edit
add_watermarker = add_watermarker if add_watermarker is not None else is_invisible_watermark_available()
@@ -551,6 +555,9 @@ class StableDiffusionXLInstructPix2PixPipeline(
if image_latents.dtype != self.vae.dtype:
image_latents = image_latents.to(dtype=self.vae.dtype)
if self.is_cosxl_edit:
image_latents = image_latents * self.vae.config.scaling_factor
return image_latents
# Copied from diffusers.pipelines.stable_diffusion_xl.pipeline_stable_diffusion_xl.StableDiffusionXLPipeline._get_add_time_ids