Skip to content

Commit 8873d3d

Browse files
committed
fix w h
1 parent 2da4741 commit 8873d3d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

examples/text_to_image/pipeline_stable_diffusion_img2img_render_text.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,13 @@ def __call__(
177177
"""
178178

179179
# 1. Check inputs
180-
self.check_inputs(prompt, strength, callback_steps)
180+
# copied from https://github.com/huggingface/diffusers/blob/main/examples/community/img2img_inpainting.py
181+
if isinstance(image, PIL.Image.Image):
182+
w, h = image.size
183+
elif isinstance(image, torch.Tensor):
184+
*_, h, w = image.shape
185+
186+
self.check_inputs(prompt, h, w, callback_steps)
181187

182188
# 2. Define call parameters
183189
batch_size = 1 if isinstance(prompt, str) else len(prompt)
@@ -207,11 +213,6 @@ def __call__(
207213
# 6.1 Prepare latent variables
208214
num_channels_latents = self.unet.in_channels // 2
209215

210-
# copied from https://github.com/huggingface/diffusers/blob/main/examples/community/img2img_inpainting.py
211-
if isinstance(image, PIL.Image.Image):
212-
w, h = image.size
213-
elif isinstance(image, torch.Tensor):
214-
*_, h, w = image.shape
215216

216217
latents = self.prepare_latents(
217218
batch_size * num_images_per_prompt,

0 commit comments

Comments
 (0)