-
Notifications
You must be signed in to change notification settings - Fork 6.6k
[refactor]Scheduler.set_begin_index #6728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
…step_index copy from dpm
| @begin_index.setter | ||
| def begin_index(self, index): | ||
| self._begin_index = index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @begin_index.setter | |
| def begin_index(self, index): | |
| self._begin_index = index | |
| @begin_index.setter | |
| def begin_index(self, index): | |
| self._begin_index = index |
Are we using this function?
I don't really see a self.begin_index = ... anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok will remove :)
|
Generally this PR looks good to me - just wondering about the |
This refactor affects 16 schedulers that implement
step_indexcounter, except the dpm multistep inverse scheduler (I did not update it; I removed the#copied fromstatement)begin_indexproperty andset_begin_index()method to all schedulers that implement thestep_indexcounter. This will allow pipelines to set the first index for the scheduler'sstep_indexcounter before the denoising loop. This is particularly useful for img2img pipelines because it may have duplicated first timesteps (see more on https://github.com/huggingface/diffusers/pull/5746/files)index_for_timestepmethod, which contains the logic to convert timestep into sigma index. This is now used by both_init_step_index()andadd_noise()methods to decide the very firststep_indexwhenbegin_indexhas not been set from the pipeline. The DPM schedulers (dpm-multistep, dpm-singlastep, deis, unipc, sasolver) has slightly differentindex_for_timestepmethod from the rest of the schedulers._init_step_index()andadd_noise()methods across the schedulers so they have consistent definitions and added the#Copied fromstatement whenever possible_index_counterin heun and a couple other schedulers - it was introduced before we had the step_index counter and no longer needed