feat: add DPM++ 2M SDE (Brownian tree) sampler#1743
Merged
Conversation
Owner
|
Thank you for your contribution. |
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
Adds
dpm++2m_sde_bt- the DPM++ 2M SDE variant that k-diffusion / ComfyUI expose assample_dpmpp_2m_sde_gpu. Same math as thedpm++2m_sdemerged in #1742, but the noise per step comes from a seeded Brownian tree instead of a freshrandn_like, giving step-count-stable composition: the same seed at 20 and 40 steps produces the same image, only fine detail differs.The k-diffusion
_gpusuffix is legacy naming (torchsde used to require CUDA tensors) - the algorithm is scalar-side and backend-agnostic. Named_bthere for honesty, withk_dpmpp_2m_sde_gpu/dpm++ 2m sde gpualiased in the sdapi mapper for A1111 / Comfy compatibility.Related Issue / Discussion
Follow-up to #1742.
Additional Information
Verified end to end on SD 1.5 (
v1-5-pruned-emaonly-fp16), 512x512, karras, seed 42, prompt"a cat". Same seed, only step count varies. Runtime overhead of the Brownian tree is ~1% (SD 1.5 20-step: 9.01s vs 8.93s for the non-BT variant).Step-count stability (this is the point)
dpm++2m_sde_bt(this PR)dpm++2m_sde(baseline)Top row: same tortoiseshell portrait, same eyes, same background - refined detail only. Bottom row: two unrelated cats.
Design notes
BrownianTreeNoiseSampleris a recursive Brownian bridge with fixed max depth (24 levels). Each interval seed derives from the base seed via splitmix64 + branch salt, so the noise at any point is a pure function of the seed and the position within[sigma_min, sigma_max], independent of which schedule sigmas are queried. This is what gives the step-count stability.sigma_aon the next step.Checklist