Unverified Commit 6070b32f authored by Dev Aggarwal's avatar Dev Aggarwal Committed by GitHub
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: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
parent 0392eceb
...@@ -695,6 +695,8 @@ class IFSuperResolutionPipeline(DiffusionPipeline): ...@@ -695,6 +695,8 @@ class IFSuperResolutionPipeline(DiffusionPipeline):
def __call__( def __call__(
self, self,
prompt: Union[str, List[str]] = None, prompt: Union[str, List[str]] = None,
height: int = None,
width: int = None,
image: Union[PIL.Image.Image, np.ndarray, torch.FloatTensor] = None, image: Union[PIL.Image.Image, np.ndarray, torch.FloatTensor] = None,
num_inference_steps: int = 50, num_inference_steps: int = 50,
timesteps: List[int] = None, timesteps: List[int] = None,
...@@ -720,6 +722,10 @@ class IFSuperResolutionPipeline(DiffusionPipeline): ...@@ -720,6 +722,10 @@ class IFSuperResolutionPipeline(DiffusionPipeline):
prompt (`str` or `List[str]`, *optional*): prompt (`str` or `List[str]`, *optional*):
The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`. The prompt or prompts to guide the image generation. If not defined, one has to pass `prompt_embeds`.
instead. instead.
height (`int`, *optional*, defaults to self.unet.config.sample_size):
The height in pixels of the generated image.
width (`int`, *optional*, defaults to self.unet.config.sample_size):
The width in pixels of the generated image.
image (`PIL.Image.Image`, `np.ndarray`, `torch.FloatTensor`): image (`PIL.Image.Image`, `np.ndarray`, `torch.FloatTensor`):
The image to be upscaled. The image to be upscaled.
num_inference_steps (`int`, *optional*, defaults to 50): num_inference_steps (`int`, *optional*, defaults to 50):
...@@ -806,8 +812,8 @@ class IFSuperResolutionPipeline(DiffusionPipeline): ...@@ -806,8 +812,8 @@ class IFSuperResolutionPipeline(DiffusionPipeline):
# 2. Define call parameters # 2. Define call parameters
height = self.unet.config.sample_size height = height or self.unet.config.sample_size
width = self.unet.config.sample_size width = width or self.unet.config.sample_size
device = self._execution_device device = self._execution_device
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment