Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
AUTOMATIC1111 merged 8 commits intoAUTOMATIC1111:devfromv0xie:beta-sampling
Jul 20, 2024
Merged

Conversation

@v0xie
Copy link
Contributor

@v0xiev0xie commentedJul 18, 2024
edited
Loading

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

  • Add new scheduler "Beta"
  • Adds two options in Sampler Parameters: "Beta scheduler - alpha" and "Beta scheduler - beta"
  • Add "Beta schedule alpha" and "Beta schedule beta" to XYZ plot options
  • Writes alpha/beta to infotext when scheduler is "Beta"

Additional links:

The authors' paper describing the method:https://arxiv.org/abs/2407.12173

Checklist:

Screenshots/videos:

SD XL

xyz_grid-0402-268845887

xyz_grid-0415-2594282800

Panchovix, wkpark, Jaid, and ligerye reacted with thumbs up emoji
Panchovix added a commit to Panchovix/stable-diffusion-webui-reForge that referenced this pull requestJul 19, 2024
Panchovix added a commit to Panchovix/stable-diffusion-webui-reForge that referenced this pull requestJul 19, 2024
@v0xiev0xie marked this pull request as ready for reviewJuly 19, 2024 22:57
@AUTOMATIC1111AUTOMATIC1111 merged commit5a10bb9 intoAUTOMATIC1111:devJul 20, 2024
@ibrainventures
Copy link
Contributor

ibrainventures commentedAug 5, 2024
edited
Loading

If i load a image by PNG Info Tab, there are correctly the Beta schedule sub-params included:

Beta schedule alpha: 0.45, Beta schedule beta: 0.8, Version: v1.10.1

But those params are not respected by System after pressing "Send to txt2img".
There are still the "system saved params" (which are as example 0.5 / 0.7 saved) active.
Which gives a different output..

Is it possible to include / resepect those image-specific params?

Thanks for this scheduler, which is really a great scheduler type.

@heftig
Copy link

heftig commentedJan 8, 2025
edited
Loading

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.

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@AUTOMATIC1111AUTOMATIC1111AUTOMATIC1111 approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@v0xie@ibrainventures@heftig@AUTOMATIC1111

[8]ページ先頭

©2009-2025 Movatter.jp