Skip to content

Commit 1763090

Browse files
author
bghira
committed
diffusers#4003 Subtract one from our intended step goal, when we are provided a defined timestep to begin on.
1 parent 77469f5 commit 1763090

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,10 @@ def __call__(
883883
image = self.image_processor.preprocess(image)
884884

885885
# 5. Prepare timesteps
886+
if begin_inference_step is not None:
887+
# In Diffusers pipelines, each generation always does ONE more step than asked.
888+
# As a result, we need to reduce the number of steps we do for this subsequent by one, to remain aligned.
889+
num_inference_steps -= 1
886890
self.scheduler.set_timesteps(num_inference_steps, device=device)
887891
timesteps, num_inference_steps = self.get_timesteps(num_inference_steps, begin_inference_step, strength, device)
888892
latent_timestep = timesteps[:1].repeat(batch_size * num_images_per_prompt)

0 commit comments

Comments
 (0)