Skip to content

Commit f3fac68

Browse files
mikegartsmishka
andauthored
small bugfix at StableDiffusionDepth2ImgPipeline call to check_inputs and batch size calculation (huggingface#2423)
small bugfix in call to check_inputs and batch size calculation Co-authored-by: mishka <[email protected]>
1 parent 8f1fe75 commit f3fac68

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,13 +587,26 @@ def __call__(
587587
(nsfw) content, according to the `safety_checker`.
588588
"""
589589
# 1. Check inputs
590-
self.check_inputs(prompt, strength, callback_steps)
590+
self.check_inputs(
591+
prompt,
592+
strength,
593+
callback_steps,
594+
negative_prompt=negative_prompt,
595+
prompt_embeds=prompt_embeds,
596+
negative_prompt_embeds=negative_prompt_embeds,
597+
)
591598

592599
if image is None:
593600
raise ValueError("`image` input cannot be undefined.")
594601

595602
# 2. Define call parameters
596-
batch_size = 1 if isinstance(prompt, str) else len(prompt)
603+
if prompt is not None and isinstance(prompt, str):
604+
batch_size = 1
605+
elif prompt is not None and isinstance(prompt, list):
606+
batch_size = len(prompt)
607+
else:
608+
batch_size = prompt_embeds.shape[0]
609+
597610
device = self._execution_device
598611
# here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
599612
# of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`

0 commit comments

Comments
 (0)