allow shorter timesteps on uncond

This commit is contained in:
Extraltodeus 2025-08-21 03:23:34 +02:00 committed by GitHub
parent e73a9dbe30
commit 0783a02d9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -361,8 +361,10 @@ def cfg_function(model, cond_pred, uncond_pred, cond_scale, x, timestep, model_o
args = {"cond": x - cond_pred, "uncond": x - uncond_pred, "cond_scale": cond_scale, "timestep": timestep, "input": x, "sigma": timestep,
"cond_denoised": cond_pred, "uncond_denoised": uncond_pred, "model": model, "model_options": model_options}
cfg_result = x - model_options["sampler_cfg_function"](args)
else:
elif uncond_pred.any():
cfg_result = uncond_pred + (cond_pred - uncond_pred) * cond_scale
else:
cfg_result = cond_pred
for fn in model_options.get("sampler_post_cfg_function", []):
args = {"denoised": cfg_result, "cond": cond, "uncond": uncond, "cond_scale": cond_scale, "model": model, "uncond_denoised": uncond_pred, "cond_denoised": cond_pred,