Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,11 @@ def __init__(
scheduler=scheduler,
movq=movq,
)
movq_scale_factor = 2 ** (len(self.movq.config.block_out_channels) - 1)
self.image_processor = VaeImageProcessor(
vae_scale_factor=movq_scale_factor,
vae_latent_channels=self.movq.config.latent_channels,
resample="bicubic",
reducing_gap=1,
)
kwargs = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

ohh we can just give them a default value like this

movq_scale_factor = 2 ** (len(self.movq.config.block_out_channels) - 1) if getattr(self, "movq", None) else ..
movq_latent_channels = self.movq.config.latent_channels if getattr(self, "movq", None) else ..

to be consistent with how it is handled in other pipelines, for example https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py#L218

if self.movq:
kwargs["vae_scale_factor"] = 2 ** (len(self.movq.config.block_out_channels) - 1)
kwargs["vae_latent_channels"] = self.movq.config.latent_channels
self.image_processor = VaeImageProcessor(resample="bicubic", reducing_gap=1, **kwargs)

# Copied from diffusers.pipelines.kandinsky.pipeline_kandinsky_img2img.KandinskyImg2ImgPipeline.get_timesteps
def get_timesteps(self, num_inference_steps, strength, device):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,11 @@ def __init__(
scheduler=scheduler,
movq=movq,
)
movq_scale_factor = 2 ** (len(self.movq.config.block_out_channels) - 1)
self.image_processor = VaeImageProcessor(
vae_scale_factor=movq_scale_factor,
vae_latent_channels=self.movq.config.latent_channels,
resample="bicubic",
reducing_gap=1,
)
kwargs = {}
if self.movq:
kwargs["vae_scale_factor"] = 2 ** (len(self.movq.config.block_out_channels) - 1)
kwargs["vae_latent_channels"] = self.movq.config.latent_channels
self.image_processor = VaeImageProcessor(resample="bicubic", reducing_gap=1, **kwargs)

# Copied from diffusers.pipelines.kandinsky.pipeline_kandinsky_img2img.KandinskyImg2ImgPipeline.get_timesteps
def get_timesteps(self, num_inference_steps, strength, device):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,11 @@ def __init__(
self.register_modules(
tokenizer=tokenizer, text_encoder=text_encoder, unet=unet, scheduler=scheduler, movq=movq
)
movq_scale_factor = 2 ** (len(self.movq.config.block_out_channels) - 1)
self.image_processor = VaeImageProcessor(
vae_scale_factor=movq_scale_factor,
vae_latent_channels=self.movq.config.latent_channels,
resample="bicubic",
reducing_gap=1,
)
kwargs = {}
if self.movq:
kwargs["vae_scale_factor"] = 2 ** (len(self.movq.config.block_out_channels) - 1)
kwargs["vae_latent_channels"] = self.movq.config.latent_channels
self.image_processor = VaeImageProcessor(resample="bicubic", reducing_gap=1, **kwargs)

def get_timesteps(self, num_inference_steps, strength, device):
# get the original timestep using init_timestep
Expand Down
Loading