The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
sampler_cfg_function now uses a dict for the argument.
comfyanonymous388567f20b86
diff --git a/comfy/samplers.py b/comfy/samplers.pyindex d3cd901e7..dffd7fe7c 100644--- a/comfy/samplers.py+++ b/comfy/samplers.py@@ -273,7 +273,8 @@ def sampling_function(model_function, x, timestep, uncond, cond, cond_scale, conmax_total_area = model_management.maximum_batch_area()cond, uncond = calc_cond_uncond_batch(model_function, cond, uncond, x, timestep, max_total_area, cond_concat, model_options)if "sampler_cfg_function" in model_options:- return model_options["sampler_cfg_function"](cond, uncond, cond_scale)+ args = {"cond": cond, "uncond": uncond, "cond_scale": cond_scale, "timestep": timestep}+ return model_options["sampler_cfg_function"](args)else:return uncond + (cond - uncond) * cond_scalediff --git a/comfy/sd.py b/comfy/sd.pyindex 4b3cb83a3..5237df3a0 100644--- a/comfy/sd.py+++ b/comfy/sd.py@@ -1,6 +1,7 @@import torchimport contextlibimport copy+import inspectfrom . import sd1_clipfrom . import sd2_clip@@ -313,8 +314,10 @@ class ModelPatcher:self.model_options["transformer_options"]["tomesd"] = {"ratio": ratio}def set_model_sampler_cfg_function(self, sampler_cfg_function):- self.model_options["sampler_cfg_function"] = sampler_cfg_function-+ if len(inspect.signature(sampler_cfg_function).parameters) == 3:+ self.model_options["sampler_cfg_function"] = lambda args: sampler_cfg_function(args["cond"], args["uncond"], args["cond_scale"]) #Old way+ else:+ self.model_options["sampler_cfg_function"] = sampler_cfg_functiondef set_model_patch(self, patch, name):to = self.model_options["transformer_options"]