[Schedulers] Add beta sigmas / beta noise schedule #9509
Merged
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.
What does this PR do?
This PR adds beta sigmas from Beta Sampling is All You Need. Added only to Euler for now, after initial review we will add it to other schedulers. Documentation will be updated for this scheduler and any others implemented in a subsequent PR after the initial review and after they've been added to other schedulers.
The implementation is quite simple, we add
use_beta_sigmas
parameter and_convert_to_beta
function.Beta sigmas depends on
scipy
so we add a check withis_scipy_available()
.The check for
self.config.use_exponential_sigmas and self.config.use_karras_sigmas
is moved to schedule instantiation and changed to usesum([self.config.use_beta_sigmas, self.config.use_exponential_sigmas, self.config.use_karras_sigmas]) > 1
, any future noise schedules can be added to the list to ensure only one can be selected.As a note for reviewers:
alpha
andbeta
in_convert_to_beta
are set to the default values used by Forge, should we make these configurable so we can set e.g.beta_sigmas_alpha=1.0
,beta_sigmas_beta=1.0
? I don't know how common it is to change these values. This is also relevant to futurepolyexponential
sigmas,polyexponential
produces the same asexponential
unless therho
value is changed, again I don't know how common it is to change this value, if we're not going to make the values configurable we don't need to addpolyexponential
. However it would be nice to have 1:1 compatibility with the webuis.Example usage:
Note that we set
timestep_spacing="linspace"
in addition touse_beta_sigmas=True
, this is because XL's scheduler config usestimestep_spacing="leading"
by default and the intent is to match results from the webuis where these noise schedules are currently used. We may wish to overridetimestep_spacing
tolinspace
whenuse_beta_sigmas=True
or add a warning.Tested against Forge (note that
cuda
device for generator is essential to match Forge results):and with the same settings on Forge we get the same result:

The output is similar yet better than exponential #9499 note the shape of Kirby's feet and the planets.
Both beta and exponential are better than the default noise schedule with XL:

#9490
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
cc @asomoza @yiyixuxu