The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Enable cfg1 optimization for DualModelGuider with CFGGuider (#14290)
Jukka Seppänen5aa71b9bc288
diff --git a/comfy_extras/nodes_custom_sampler.py b/comfy_extras/nodes_custom_sampler.pyindex 2f4ff1f70..3e97084a4 100644--- a/comfy_extras/nodes_custom_sampler.py+++ b/comfy_extras/nodes_custom_sampler.py@@ -933,9 +933,10 @@ class Guider_DualModel(comfy.samplers.CFGGuider):def predict_noise(self, x, timestep, model_options={}, seed=None):positive = self.conds.get("positive", None)- if self.uncond_inner is None: # cfg == 1 or no negative -> single model, cond only- return comfy.samplers.calc_cond_batch(self.inner_model, [positive], x, timestep, model_options)[0]cond = comfy.samplers.calc_cond_batch(self.inner_model, [positive], x, timestep, model_options)[0]+ # uncond model not loaded (base cfg==1/no negative), or cfg driven to 1.0 this step -> single model, cond only+ if self.uncond_inner is None or (math.isclose(self.cfg, 1.0) and not model_options.get("disable_cfg1_optimization", False)):+ return conduncond_model_options = model_optionsif "multigpu_clones" in model_options: # TODO: support multigpu instead of just running uncond on a single GPU@@ -1140,7 +1141,7 @@ class CFGOverride(io.ComfyNode):return io.Schema(node_id="CFGOverride",display_name="CFG Override",- description="Override cfg to a fixed value over a [start, end] percent slice of the steps. "+ description="Override cfg to a fixed value over a [start, end] percent (sigma) range. ""With multiple overrides, the one nearest the sampler wins on overlap.",category="sampling/custom_sampling",inputs=[