Minor cleanups for ancestral support
This commit is contained in:
+4
-5
@@ -82,7 +82,6 @@ def get_ancestral_step_ext(sigma, sigma_next, eta=1.0, is_rf=False):
|
|||||||
sigma_down = sigma_next * downstep_ratio
|
sigma_down = sigma_next * downstep_ratio
|
||||||
alpha_ip1, alpha_down = 1.0 - sigma_next, 1.0 - sigma_down
|
alpha_ip1, alpha_down = 1.0 - sigma_next, 1.0 - sigma_down
|
||||||
sigma_up = (sigma_next**2 - sigma_down**2 * alpha_ip1**2 / alpha_down**2)**0.5
|
sigma_up = (sigma_next**2 - sigma_down**2 * alpha_ip1**2 / alpha_down**2)**0.5
|
||||||
sigma_down_i_ratio = sigma_down / sigma
|
|
||||||
x_coeff = alpha_ip1 / alpha_down
|
x_coeff = alpha_ip1 / alpha_down
|
||||||
return sigma_down, sigma_up, x_coeff
|
return sigma_down, sigma_up, x_coeff
|
||||||
|
|
||||||
@@ -91,10 +90,10 @@ def internal_step(x, d, dt, sigma, sigma_next, sigma_up, x_coeff, noise_sampler)
|
|||||||
if sigma_up == 0 or noise_sampler is None:
|
if sigma_up == 0 or noise_sampler is None:
|
||||||
return x
|
return x
|
||||||
noise = noise_sampler(sigma, sigma_next).mul_(sigma_up)
|
noise = noise_sampler(sigma, sigma_next).mul_(sigma_up)
|
||||||
if x_coeff == 1:
|
if x_coeff != 1:
|
||||||
# Non-flow path.
|
# x gets scaled for flow models.
|
||||||
return x.add_(noise)
|
x *= x_coeff
|
||||||
return x.mul_(x_coeff).add_(noise)
|
return x.add_(noise)
|
||||||
|
|
||||||
def fix_step_range(steps, start, end):
|
def fix_step_range(steps, start, end):
|
||||||
if start < 0:
|
if start < 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user