4 Commits
Author SHA1 Message Date
asagi4 181641ca04 v0.4.0 2025-05-03 21:12:06 +03:00
asagi4 20dffb1fd0 Merge pull request #13 from ComfyNodePRs/update-publish-yaml
Update Github Action for Publishing to Comfy Registry
2025-02-24 09:21:40 +02:00
snomiao 4907ef1b6f chore(publish): update GitHub Actions workflow for node publishing
- Add permissions for issue writing
- Update action version to v1 for publish-node-action
- Add condition to run job only for 'asagi4' repository owner
2025-01-20 21:33:44 +00:00
asagi4 8fc3b008ad Implement adaptive projected guidance, with adaptive momentum stolen from
https://github.com/MythicalChu/ComfyUI-APG_ImYourCFGNow

I'm not sure which type of model output the algorithm works better with,
so pick your preferred one by setting the mode to "normal" or "denoised"

Fixes #11

Fix Adaptive momentum; was using the momentum as CFG
2024-11-23 19:32:59 +02:00
5 changed files with 18 additions and 6 deletions
+5 -1
View File
@@ -7,15 +7,19 @@ on:
paths:
- "pyproject.toml"
permissions:
issues: write
jobs:
publish-node:
name: Publish Custom Node to registry
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'asagi4' }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Publish Custom Node
uses: Comfy-Org/publish-node-action@main
uses: Comfy-Org/publish-node-action@v1
with:
## Add your own personal access token to your Github Repository secrets and reference it here.
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
+1 -1
View File
@@ -4,7 +4,7 @@ An implementation of adaptive guidance for ComfyUI
See https://bcv-uniandes.github.io/adaptiveguidance-wp/
Import [this workflow](workflows/AGExample.json?raw=1) into ComfyUI to compare Adaptive Guidance vs. normal CFG.
Import [this workflow](example_workflows/AGExample.json?raw=1) into ComfyUI to compare Adaptive Guidance vs. normal CFG.
## What
+11 -3
View File
@@ -215,8 +215,14 @@ class AdaptiveProjectedGuidanceFunction:
cond = args["cond"]
uncond = args["uncond"]
cfg_scale = args["cond_scale"]
sigma = args["sigma"][0].item()
step = args["model"].model_sampling.timestep(args["sigma"])[0].item()
x = args["input"]
x_orig = args["input"]
if self.mode == "vpred":
sigma = step
x = x_orig / (sigma * sigma + 1.0)
cond = ((x - (x_orig - cond)) * (sigma**2 + 1.0) ** 0.5) / (sigma)
uncond = ((x - (x_orig - uncond)) * (sigma**2 + 1.0) ** 0.5) / (sigma)
if self.current_step < step:
self.current_step = 999.0
@@ -249,7 +255,9 @@ class AdaptiveProjectedGuidanceFunction:
pred = cond + (cfg_scale - 1) * (diff_orthogonal + self.eta * diff_parallel)
if "denoised" == self.mode:
pred = x - pred
pred = x_orig - pred
elif "vpred" == self.mode:
pred = x_orig - (x - pred * sigma / (sigma * sigma + 1.0) ** 0.5)
return pred
@@ -262,7 +270,7 @@ class AdaptiveProjectedGuidance:
"momentum": ("FLOAT", {"default": 0.5, "min": -1.0, "max": 1.0, "step": 0.01}),
"eta": ("FLOAT", {"default": 1, "min": 0.0, "max": 1.0, "step": 0.01}),
"norm_threshold": ("FLOAT", {"default": 15.0, "min": 0.0, "max": 50.0, "step": 0.1}),
"mode": (["normal", "denoised"],),
"mode": (["normal", "denoised", "vpred"],),
"adaptive_momentum": ("FLOAT", {"default": 0.18, "min": 0, "max": 1.0, "step": 0.01}),
},
}
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-adaptive-guidance"
description = "An implementation of adaptive guidance for ComfyUI\nSee https://bcv-uniandes.github.io/adaptiveguidance-wp/"
version = "0.3.1"
version = "0.4.0"
license = { text = "GNU General Public License v3.0" }
[project.urls]