From 3722b4e5f6dfea490a076e288c3be77c48c6a4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kerbiriou?= Date: Fri, 8 Dec 2023 15:24:53 +0100 Subject: [PATCH] sampler_cfg_function get a true timestep --- comfy/samplers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/comfy/samplers.py b/comfy/samplers.py index 75b2f130b..790990b5b 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -251,7 +251,8 @@ def sampling_function(model, x, sigmas, uncond, cond, cond_scale, model_options= cond, uncond = calc_cond_uncond_batch(model, cond, uncond, x, sigmas, model_options) if "sampler_cfg_function" in model_options: - args = {"cond": x - cond, "uncond": x - uncond, "cond_scale": cond_scale, "input": x, "sigma": sigmas} + timesteps = model.model_sampling.timestep(sigmas) + args = {"cond": x - cond, "uncond": x - uncond, "cond_scale": cond_scale, "timestep": timesteps, "input": x, "sigma": sigmas} return x - model_options["sampler_cfg_function"](args) else: return uncond + (cond - uncond) * cond_scale