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

Custom CFG πŸŽ­πŸ…πŸ…“

Overriding your sampler's guidance in AnimateDiff-Evolved

By KosinkadinkΒ·Created 3 years agoΒ·Updated 8 days agoΒ· 3,519
Custom CFG πŸŽ­πŸ…πŸ…“
  • cfg_extras
  • CUSTOM_CFG
β—„cfg8.0β–Ί

If you've used AnimateDiff-Evolved's Sample Settings system, this is the node that feeds it a CFG value - and specifically, the constant one. "Custom CFG" as a family also supports scheduled/keyframed CFG elsewhere in the pack; this "Simple" version is the flat, single-number base case: one CFG for the whole generation, optionally dressed up with extras.

Why AnimateDiff wants its own CFG node at all

Normally CFG is just a number you type into your KSampler and forget about. AnimateDiff-Evolved builds a parallel settings system (Sample Settings, fed by nodes like this one, the Sigma Schedule node, and others) so that CFG, noise scheduling, and related behavior can be controlled per-animation rather than inherited wholesale from whatever the KSampler node happens to expose - and, more importantly, so CFG can be modified by "extras" like RescaleCFG or PAG without you having to hand-roll that logic yourself.

Inputs and output

  • cfg - your guidance scale, 0–100, default 8. This works the same as CFG anywhere else: push it up for tighter prompt adherence, push it down for more freedom. On SD1.5-based AnimateDiff workflows the useful range is usually 5–9, similar to plain SD1.5 image generation - AnimateDiff doesn't change the sweet spot for the base checkpoint, it just runs it across frames.
  • cfg_extras (optional) - chains in a CFG_EXTRAS value from nodes like CFG Extrasβ—†RescaleCFG or CFG Extrasβ—†PAG. These modify how CFG is applied under the hood (fixing overexposure at high CFG, or adding a perturbed-attention guidance signal) without you having to change the base cfg number.

Output is CUSTOM_CFG, which plugs into the Sample Settings node.

How to install it

Bundled with the pack.

  • ComfyUI Manager - search AnimateDiff Evolved by Kosinkadink, install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved, restart.
  • Needs a motion module in ComfyUI/models/animatediff_models for the rest of the pipeline this feeds.

Common issues & troubleshooting

Colors blow out or contrast goes extreme at higher CFG. This is a general CFG behavior, not specific to AnimateDiff - push guidance too high on an SD1.5-lineage checkpoint and you get oversaturation and burn, sometimes with visible face deformation. If you need the adherence a higher CFG gives you but don't want the burn, chain a CFG Extrasβ—†RescaleCFG node into cfg_extras rather than fighting it by lowering cfg and losing adherence.

Wired this in but the KSampler's own CFG still seems to win, or nothing changes. This node only has an effect once its CUSTOM_CFG output actually reaches a Sample Settings node that's connected into your AnimateDiff model-application chain. If Sample Settings isn't in the graph, or isn't wired to the model actually being sampled, this node is doing nothing - it doesn't retroactively patch your KSampler on its own.

Not sure whether you need this at all. If you're happy with a flat CFG and don't need RescaleCFG or PAG, just set CFG on your KSampler normally and skip this whole system. It exists for people who want scheduled or extras-modified guidance specifically for animation work.

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

Inputs (2)

NameTypeDefaultDescription
cfgFLOAT8.00–100β€”
cfg_extrasoptCFG_EXTRASβ€”

Outputs (1)

NameTypeDescription
CUSTOM_CFGCUSTOM_CFGβ€”