KJNodes/experimentalgenerated

CFG Zero Star/Init(CFGZeroStarAndInit)

This node performs patching operations within the model, modifying the CFG calculation process during sampling.

CFG Zero Star And Init

model
MODEL
use_zero_init
zero_init_steps
0
KJNodes

The CFG Zero Star/Init node performs patching operations within the model, modifying the CFG calculation process during sampling.

CFG Zero Star/Init is an experimental node designed for advanced control of Conditional Free Guidance (CFG) during the diffusion model sampling process. It influences model generation by zeroing out conditional information in the initial steps.

Node Functionality

This node performs patching operations within the model, modifying the CFG calculation process during sampling. Its core mechanism is "Zero Initialization," which can set the conditional input to zero for a specified number of initial sampling steps, thereby reducing the influence of the condition on generation in the early stages.

Node Parameter Description - CFG Zero Star/Init

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
modelMODELYes--model (input parameter): Receives the diffusion model requiring CFG adjustment. This parameter serves as the target object for the node's internal patching operation.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
use_zero_initBOOLEANYesTrue-use_zero_init (input parameter): Boolean switch to enable or disable the "Zero Initialization" function. Default value is True (enabled).
zero_init_stepsINTYes0Min: 0For zero init, starts from 0 so the first step is always zeroed out if use_zero_init is enabled.

Output

Parameter NameData TypeDescription
MODELMODELMODEL (output parameter): Outputs the model object modified by the CFG adjustment mechanism.

Usage Scenarios

This node is useful in workflows requiring fine-grained control over the image generation process. For example, when a user wants the generated result to generally conform to a text prompt but wishes to reduce the strong constraint of the text during the initial composition phase to avoid excessive rigidity, this node can be inserted before the KSampler. By enabling use_zero_init and setting zero_init_steps, the condition can be "faded" during the first few sampling steps, giving the model more freedom to explore.

Notes

This node is marked as experimental; its behavior may change with updates to ComfyUI or underlying libraries. It directly modifies the incoming model object, so it should be placed carefully within the workflow, typically immediately before the model input used for final sampling.

The CFG Zero Star/Init node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…