Skip to content

Commit

Permalink
sampler_cfg_function now gets the noisy output as argument again.
Browse files Browse the repository at this point in the history
This should make things that use sampler_cfg_function behave like before.

Added an input argument for those that want the denoised output.

This means you can calculate the x0 prediction of the model by doing:
(input - cond) for example.
  • Loading branch information
comfyanonymous committed Nov 2, 2023
1 parent 2455aae commit d2e27b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions comfy/samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ def calc_cond_uncond_batch(model_function, cond, uncond, x_in, timestep, max_tot

cond, uncond = calc_cond_uncond_batch(model_function, cond, uncond, x, timestep, max_total_area, model_options)
if "sampler_cfg_function" in model_options:
args = {"cond": cond, "uncond": uncond, "cond_scale": cond_scale, "timestep": timestep}
return model_options["sampler_cfg_function"](args)
args = {"cond": x - cond, "uncond": x - uncond, "cond_scale": cond_scale, "timestep": timestep, "input": x}
return x - model_options["sampler_cfg_function"](args)
else:
return uncond + (cond - uncond) * cond_scale

Expand Down

0 comments on commit d2e27b4

Please sign in to comment.