MCPcopy
hub / github.com/XPixelGroup/DiffBIR / get_ancestral_step

Function get_ancestral_step

diffbir/sampler/k_diffusion.py:56–63  ·  view source on GitHub ↗

Calculates the noise level (sigma_down) to step down to and the amount of noise to add (sigma_up) when doing an ancestral sampling step.

(sigma_from, sigma_to, eta=1.)

Source from the content-addressed store, hash-verified

54
55
56def get_ancestral_step(sigma_from, sigma_to, eta=1.):
57 """Calculates the noise level (sigma_down) to step down to and the amount
58 of noise to add (sigma_up) when doing an ancestral sampling step."""
59 if not eta:
60 return sigma_to, 0.
61 sigma_up = min(sigma_to, eta * (sigma_to ** 2 * (sigma_from ** 2 - sigma_to ** 2) / sigma_from ** 2) ** 0.5)
62 sigma_down = (sigma_to ** 2 - sigma_up ** 2) ** 0.5
63 return sigma_down, sigma_up
64
65
66def default_noise_sampler(x):

Callers 6

sample_euler_ancestralFunction · 0.85
sample_dpm_2_ancestralFunction · 0.85
dpm_solver_fastMethod · 0.85
dpm_solver_adaptiveMethod · 0.85
sample_dpmpp_sdeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected