From 8a7c894d5415c499817c1fcdcba26940755c03a4 Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Tue, 13 May 2025 10:50:32 -0700 Subject: [PATCH] fix negative momentum (#8100) --- comfy_extras/nodes_apg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy_extras/nodes_apg.py b/comfy_extras/nodes_apg.py index 1325985b..25b21b1b 100644 --- a/comfy_extras/nodes_apg.py +++ b/comfy_extras/nodes_apg.py @@ -14,7 +14,7 @@ class APG: "model": ("MODEL",), "eta": ("FLOAT", {"default": 1.0, "min": -10.0, "max": 10.0, "step": 0.01, "tooltip": "Controls the scale of the parallel guidance vector. Default CFG behavior at a setting of 1."}), "norm_threshold": ("FLOAT", {"default": 5.0, "min": 0.0, "max": 50.0, "step": 0.1, "tooltip": "Normalize guidance vector to this value, normalization disable at a setting of 0."}), - "momentum": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01, "tooltip":"Controls a running average of guidance during diffusion, disabled at a setting of 0."}), + "momentum": ("FLOAT", {"default": 0.0, "min": -5.0, "max": 1.0, "step": 0.01, "tooltip":"Controls a running average of guidance during diffusion, disabled at a setting of 0."}), } } RETURN_TYPES = ("MODEL",) @@ -41,7 +41,7 @@ class APG: guidance = cond - uncond - if momentum > 0: + if momentum != 0: if not torch.is_tensor(running_avg): running_avg = guidance else: