|
|
|
@ -98,7 +98,7 @@ def make_beta_schedule(schedule, n_timestep, linear_start=1e-4, linear_end=2e-2,
|
|
|
|
|
alphas = torch.cos(alphas).pow(2) |
|
|
|
|
alphas = alphas / alphas[0] |
|
|
|
|
betas = 1 - alphas[1:] / alphas[:-1] |
|
|
|
|
betas = np.clip(betas, a_min=0, a_max=0.999) |
|
|
|
|
betas = torch.clamp(betas, min=0, max=0.999) |
|
|
|
|
|
|
|
|
|
elif schedule == "squaredcos_cap_v2": # used for karlo prior |
|
|
|
|
# return early |
|
|
|
@ -113,7 +113,7 @@ def make_beta_schedule(schedule, n_timestep, linear_start=1e-4, linear_end=2e-2,
|
|
|
|
|
betas = torch.linspace(linear_start, linear_end, n_timestep, dtype=torch.float64) ** 0.5 |
|
|
|
|
else: |
|
|
|
|
raise ValueError(f"schedule '{schedule}' unknown.") |
|
|
|
|
return betas.numpy() |
|
|
|
|
return betas |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def make_ddim_timesteps(ddim_discr_method, num_ddim_timesteps, num_ddpm_timesteps, verbose=True): |
|
|
|
|