Skip to content

Commit 6070b32

Browse files
Allow arbitrary aspect ratio in IFSuperResolutionPipeline (#3298)
* Update pipeline_if_superresolution.py Allow arbitrary aspect ratio in IFSuperResolutionPipeline by using the input image shape * IFSuperResolutionPipeline: allow the user to override the height and width through the arguments * update IFSuperResolutionPipeline width/height doc string to match StableDiffusionInpaintPipeline conventions --------- Co-authored-by: Patrick von Platen <[email protected]>
1 parent 0392ece commit 6070b32

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/diffusers/pipelines/deepfloyd_if/pipeline_if_superresolution.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ def preprocess_image(self, image, num_images_per_prompt, device):
695695
def __call__(
696696
self,
697697
prompt: Union[str, List[str]] = None,
698+
height: int = None,
699+
width: int = None,
698700
image: Union[PIL.Image.Image, np.ndarray, torch.FloatTensor] = None,
699701
num_inference_steps: int = 50,
700702
timesteps: List[int] = None,
@@ -720,6 +722,10 @@ def __call__(
720722
prompt (`str` or `List[str]`, *optional*):
721723
The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
722724
instead.
725+
height (`int`, *optional*, defaults to self.unet.config.sample_size):
726+
The height in pixels of the generated image.
727+
width (`int`, *optional*, defaults to self.unet.config.sample_size):
728+
The width in pixels of the generated image.
723729
image (`PIL.Image.Image`, `np.ndarray`, `torch.FloatTensor`):
724730
The image to be upscaled.
725731
num_inference_steps (`int`, *optional*, defaults to 50):
@@ -806,8 +812,8 @@ def __call__(
806812

807813
# 2. Define call parameters
808814

809-
height = self.unet.config.sample_size
810-
width = self.unet.config.sample_size
815+
height = height or self.unet.config.sample_size
816+
width = width or self.unet.config.sample_size
811817

812818
device = self._execution_device
813819

0 commit comments

Comments
 (0)