- Notifications
You must be signed in to change notification settings - Fork29.5k
Feature: Beta scheduler#16235
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Feature: Beta scheduler#16235
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ibrainventures commentedAug 5, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
If i load a image by PNG Info Tab, there are correctly the Beta schedule sub-params included:
But those params are not respected by System after pressing "Send to txt2img". Is it possible to include / resepect those image-specific params? Thanks for this scheduler, which is really a great scheduler type. |
heftig commentedJan 8, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Are you sure your implementation is right? It seems to be producing beta-distributed sigmas instead of beta-distributed timesteps as explained in the paper. I think we want something more like this (adapted from the 'normal' scheduler): defbeta_scheduler(n,sigma_min,sigma_max,inner_model,device,sgm=False):start=inner_model.sigma_to_t(torch.tensor(sigma_max))end=inner_model.sigma_to_t(torch.tensor(sigma_min))# From "Beta Sampling is All You Need" [arXiv:2407.12173] (Lee et. al, 2024)alpha=shared.opts.beta_dist_alphabeta=shared.opts.beta_dist_betaifsgm:timesteps=np.linspace(1,0,n+1)[:-1]else:timesteps=np.linspace(1,0,n)timesteps= [stats.beta.ppf(x,alpha,beta)forxintimesteps]sigs= []forxinrange(len(timesteps)):ts=end+ (timesteps[x]* (start-end))sigs.append(inner_model.t_to_sigma(ts))sigs+= [0.0]returntorch.FloatTensor(sigs).to(device) With this, using alpha = beta = 1.0 makes it almost identical to the uniform scheduler. |
Uh oh!
There was an error while loading.Please reload this page.
Description
This PR implements the scheduler described in"Beta Sampling is All You Need: Efficient Image Generation Strategy for Diffusion Models using Stepwise Spectral Analysis" (2024, Lee et. al). The basic conclusion of the paper is spending more time at the beginning and end of denoising improves image quality.
Output images are usually worse than other schedulers at low step count (<= 10), but improved at higher step counts ( >= 20 ).
Beta scheduler with alpha = beta = 1.0 is supposed to be equivalent to Uniform scheduler, but in practice the Uniform scheduler produces different sigmas / results.
Changes
Additional links:
The authors' paper describing the method:https://arxiv.org/abs/2407.12173
Checklist:
Screenshots/videos:
SD XL