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 @@ -367,11 +367,16 @@ def __call__(
if XLA_AVAILABLE:
xm.mark_step()

if output_type not in ["pt", "np", "pil", "latent"]:
raise ValueError(
f"Only the output types `pt`, `pil`, `np` and `latent` are supported not output_type={output_type}"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed. Refer to other pipelines for an example.

if output_type == "latent":
image = latents
else:
latents = self._unpack_latents(latents, height, width, self.vae_scale_factor)
latents = (latents / self.vae.config.scaling_factor) + self.vae.config.shift_factor
image = self.vae.decode(latents, return_dict=False)[0]
image = self.image_processor.postprocess(image, output_type=output_type)


if not output_type == "latent":
image = self.movq.decode(latents, force_not_quantize=True)["sample"]
image = self.image_processor.postprocess(image, output_type)
else:
image = latents
image = self.image_processor.postprocess(image, output_type)

# Offload all models
self.maybe_free_model_hooks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,11 +620,16 @@ def __call__(
xm.mark_step()

# post-processing
if output_type not in ["pt", "np", "pil", "latent"]:
raise ValueError(
f"Only the output types `pt`, `pil`, `np` and `latent` are supported not output_type={output_type}"
)

if not output_type == "latent":
image = self.movq.decode(latents, force_not_quantize=True)["sample"]
image = self.image_processor.postprocess(image, output_type)
else:
image = latents
image = self.image_processor.postprocess(image, output_type)

self.maybe_free_model_hooks()

Expand Down