This commit is contained in:
Extraltodeus 2025-12-03 11:43:28 -05:00 committed by GitHub
commit 1eb04ec004
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -355,8 +355,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, "input_cond": cond, "input_uncond": uncond}
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,