Repository navigation
fix(schedulers.lms): bound multistep order by available derivatives (#15108) - #15116
Open
Vuln3rat0r wants to merge 1 commit into
Open
Vuln3rat0r wants to merge 1 commit into
Vuln3rat0r wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
LMSDiscreteScheduler.stepsets multistep order fromstep_indexinstead of the number of stored derivatives. When sampling starts at an offset index (begin_index > 0, such as img2img or inpainting withstrength < 1),step_indexevaluates to a high value whileself.derivativesholds only the first sample. The scheduler calculates higher-order polynomial coefficients while missing derivatives are silently truncated byzip(), corrupting early denoising steps.Bounding
orderbylen(self.derivatives)ensures polynomial quadrature matches available history, executing order ramp-up correctly from the initial offset step.Fixes #15108.
Testing
test_step_order_with_begin_indexintests/schedulers/test_scheduler_lms.pyverifying that step calculation at an offset index matches a 1st-order Euler update on step 1 and accumulates derivatives on step 2.test_full_loop_with_noisepinned values to reflect corrected Adams-Bashforth integration when running truncated schedules.StableDiffusionImg2ImgPipelinewith an ideal predictor (relative error drops from 8.24% to 0.00%).tests/schedulers/test_scheduler_lms.py(33 passed).Reviewers
@yiyixuxu @dg845