Skip to content

Commit 8a7c894

Browse files
fix negative momentum (Comfy-Org#8100)
1 parent a814f2e commit 8a7c894

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

comfy_extras/nodes_apg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def INPUT_TYPES(s):
1414
"model": ("MODEL",),
1515
"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."}),
1616
"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."}),
17-
"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."}),
17+
"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."}),
1818
}
1919
}
2020
RETURN_TYPES = ("MODEL",)
@@ -41,7 +41,7 @@ def pre_cfg_function(args):
4141

4242
guidance = cond - uncond
4343

44-
if momentum > 0:
44+
if momentum != 0:
4545
if not torch.is_tensor(running_avg):
4646
running_avg = guidance
4747
else:

0 commit comments

Comments
 (0)