Nodes/AnimateDiff Evolved/Custom CFG Keyframes Interp. πŸŽ­πŸ…πŸ…“
ComfyUI Node Runs on cloud

Custom CFG Keyframes Interp. πŸŽ­πŸ…πŸ…“

Ramp CFG smoothly across the render

By KosinkadinkΒ·Created 3 years agoΒ·Updated 8 days agoΒ· 3,519
Custom CFG Keyframes Interp. πŸŽ­πŸ…πŸ…“
  • prev_custom_cfg
  • cfg_extras
  • CUSTOM_CFG
β—„start_percent0.000β–Ί
β—„end_percent1.000β–Ί
β—„cfg_start8.0β–Ί
β—„cfg_end8.0β–Ί
β—„interpolationβ–Ύβ–Ί
β—„intervals50β–Ί
β—„print_keyframesfalseβ–Ί

The smooth-curve version of a Custom CFG schedule: instead of a list of values, give this node a starting CFG, an ending CFG, and how many steps to interpolate across, and it builds an evenly-spaced ramp between them.

What it does

cfg_start and cfg_end (both default 8, range 0–100) are the two ends of the ramp - 8 being the classic SD 1.5-era default CFG, which makes sense as a starting point given AnimateDiff's SD 1.5 roots. start_percent and end_percent (0 and 1) bound where in the sampling process the ramp happens. interpolation is a dropdown for the curve shape - linear versus an eased ramp that moves more gradually at one or both ends. intervals (default 50, range 2–100) is how many keyframes the curve gets broken into. print_keyframes (default false) prints the generated schedule to console - worth switching on while you're first dialing in a new ramp.

prev_custom_cfg chains onto an existing Custom CFG schedule, and cfg_extras is the same pack-wide escape hatch the rest of this family exposes. Output is CUSTOM_CFG.

A concrete shape worth trying

Start cfg_start around 8–9 for strong composition and prompt adherence in the opening steps, ramp down to cfg_end around 4–5 by the end. That mirrors general SD guidance - CFG in the 5–9 range is the normal working band for SD 1.5/SDXL-based generation, and pushing much past that tends to burn and oversaturate - just applied as a gradient across the render instead of one fixed number for every frame.

Picking an intervals count

More intervals gives a smoother CFG ramp but also means more keyframe objects for the sampler to step through during the render - a real, if minor, overhead. Since CFG is usually meant to change gradually rather than in fine, imperceptible steps, something in the 10-20 range is generally enough; reserve values near the 100 ceiling for a render where you're deliberately chasing a very precise, almost continuous transition between cfg_start and cfg_end.

Installing it

ComfyUI Manager: search AnimateDiff Evolved, author Kosinkadink, install, restart. Or git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved into custom_nodes manually and restart.

Common issues

Setting cfg_start and cfg_end both to values in the double digits ramps between two already-high settings rather than actually easing off - if you're chasing the "strong start, softer finish" effect, make sure cfg_end is genuinely lower than cfg_start, not just a slightly different high number. And as with the other list and interpolation nodes in this pack, print_keyframes is there specifically so you're not guessing what the ramp produced from slider positions alone - use it.

CategoryAnimate Diff πŸŽ­πŸ…πŸ…“/sample settings/custom cfg

Inputs (9)

NameTypeDefaultDescription
start_percentFLOAT0.0000–1β€”
end_percentFLOAT1.0000–1β€”
cfg_startFLOAT8.00–100β€”
cfg_endFLOAT8.00–100β€”
interpolationCOMBO4 options: linear, ease_in, ease_out, ease_in_out
intervalsINT502–100β€”
print_keyframesBOOLEANfalseβ€”
prev_custom_cfgoptCUSTOM_CFGβ€”
cfg_extrasoptCFG_EXTRASβ€”

Outputs (1)

NameTypeDescription
CUSTOM_CFGCUSTOM_CFGβ€”