set timestep index to 0 to avoid lookup in scheduler.step #2554
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request addresses a potential issue with floating-point precision in the scheduler's timestep lookup across multiple model pipelines. The main change is the addition of a call to
self.scheduler.set_begin_index(0)before entering the denoising loop in each pipeline. This ensures robust and consistent behavior during inference by preventing failures inscheduler.step()due to precision errors, as referenced in a related HuggingFace diffusers pull request.Key changes by theme:
Scheduler Robustness and Consistency:
self.scheduler.set_begin_index(0)before the denoising loop in the__call__or equivalent method of the following pipelines to avoid floating-point precision issues in timestep lookup (see: Avoid DtoH sync from access of nonzero() item in scheduler huggingface/diffusers#11696):auraflow/pipeline.pyauraflow/pipeline_controlnet.pychroma/pipeline.pycosmos/pipeline.pyflux/pipeline.py[1] [2]flux/pipeline_controlnet.py[1] [2]hidream/pipeline.pyhunyuanvideo/pipeline.pyhunyuanvideo/pipeline_i2v.pykandinsky5_image/pipeline_kandinsky5_t2i.pykandinsky5_video/pipeline_kandinsky5_t2v.pylongcat_image/pipeline.pylongcat_image/pipeline_edit.pylongcat_video/pipeline.pyltxvideo2/pipeline_ltx2.pyltxvideo2/pipeline_ltx2_image2video.pywan/pipeline.py[1] [2]wan_s2v/pipeline.pyz_image/pipeline.pyz_image_omni/pipeline.py