From 7be71a8142119d0721f6ce332db640cf9413662a Mon Sep 17 00:00:00 2001 From: blepping Date: Tue, 24 Dec 2024 10:50:08 -0700 Subject: [PATCH] Rename kl_optimal_schedule to kl_optimal_scheduler to be more consistent --- comfy/samplers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/samplers.py b/comfy/samplers.py index d5604a8d..0641b364 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -468,7 +468,7 @@ def linear_quadratic_schedule(model_sampling, steps, threshold_noise=0.025, line return torch.FloatTensor(sigma_schedule) * model_sampling.sigma_max.cpu() # Referenced from https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15608 -def kl_optimal_schedule(n: int, sigma_min: float, sigma_max: float) -> torch.Tensor: +def kl_optimal_scheduler(n: int, sigma_min: float, sigma_max: float) -> torch.Tensor: adj_idxs = torch.arange(n, dtype=torch.float).div_(n - 1) sigmas = adj_idxs.new_zeros(n + 1) sigmas[:-1] = (adj_idxs * math.atan(sigma_min) + (1 - adj_idxs) * math.atan(sigma_max)).tan_() @@ -939,7 +939,7 @@ def calculate_sigmas(model_sampling, scheduler_name, steps): elif scheduler_name == "linear_quadratic": sigmas = linear_quadratic_schedule(model_sampling, steps) elif scheduler_name == "kl_optimal": - sigmas = kl_optimal_schedule(n=steps, sigma_min=float(model_sampling.sigma_min), sigma_max=float(model_sampling.sigma_max)) + sigmas = kl_optimal_scheduler(n=steps, sigma_min=float(model_sampling.sigma_min), sigma_max=float(model_sampling.sigma_max)) else: logging.error("error invalid scheduler {}".format(scheduler_name)) return sigmas