diff --git a/api/onnx_web/diffusers/pipelines/panorama_xl.py b/api/onnx_web/diffusers/pipelines/panorama_xl.py index e15915b3..fc41fb41 100644 --- a/api/onnx_web/diffusers/pipelines/panorama_xl.py +++ b/api/onnx_web/diffusers/pipelines/panorama_xl.py @@ -411,6 +411,8 @@ class StableDiffusionXLPanoramaPipelineMixin(StableDiffusionXLImg2ImgPipelineMix num_warmup_steps = len(timesteps) - num_inference_steps * self.scheduler.order for i, t in enumerate(self.progress_bar(timesteps)): last = i == (len(timesteps) - 1) + next_step_index = None + count.fill(0) value.fill(0) @@ -471,10 +473,11 @@ class StableDiffusionXLPanoramaPipelineMixin(StableDiffusionXLImg2ImgPipelineMix # reset the scheduler's internal timestep if prev_step_index is not None: logger.debug( - "resetting scheduler internal step index from %s to %s", + "rewinding scheduler internal step index from %s to %s", self.scheduler._step_index, prev_step_index, ) + next_step_index = self.scheduler._step_index self.scheduler._step_index = prev_step_index value[:, :, h_start:h_end, w_start:w_end] += latents_view_denoised @@ -572,6 +575,7 @@ class StableDiffusionXLPanoramaPipelineMixin(StableDiffusionXLImg2ImgPipelineMix self.scheduler._step_index, prev_step_index, ) + next_step_index = self.scheduler._step_index self.scheduler._step_index = prev_step_index if feather[0] > 0.0: @@ -602,6 +606,15 @@ class StableDiffusionXLPanoramaPipelineMixin(StableDiffusionXLImg2ImgPipelineMix latents = np.where(count > 0, value / count, value) latents = repair_nan(latents) + # update the scheduler's internal timestep, if set + if next_step_index is not None: + logger.debug( + "forwarding scheduler internal step index from %s to %s", + self.scheduler._step_index, + next_step_index, + ) + self.scheduler._step_index = next_step_index + # call the callback, if provided if i == len(timesteps) - 1 or ( (i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0