ComfyUI > Nodes > ComfyUI-APGScaling > Apply APG CFG

ComfyUI Node: Apply APG CFG

Class Name

APGFunction

Category
apg
Author
logtd (Account age: 351days)
Extension
ComfyUI-APGScaling
Latest Updated
2024-10-06
Github Stars
0.03K

How to Install ComfyUI-APGScaling

Install this extension via the ComfyUI Manager by searching for ComfyUI-APGScaling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-APGScaling in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Apply APG CFG Description

Enhances AI model control with normalized guidance for precise adjustments and refined outputs.

Apply APG CFG:

The APGFunction node, also known as "Apply APG CFG," is designed to enhance the control and flexibility of AI models by applying a specific type of guidance called "normalized guidance." This node is particularly useful for AI artists who want to fine-tune the behavior of their models, allowing for more precise adjustments in the output. The node leverages advanced techniques such as momentum and normalization to ensure that the model's predictions are guided in a controlled manner, which can be crucial for achieving desired artistic effects. By integrating these methods, the APGFunction node helps in maintaining the balance between the conditioned and unconditioned predictions, ultimately leading to more refined and controlled outputs.

Apply APG CFG Input Parameters:

model

The model parameter represents the AI model that you want to apply the APG function to. It is the core component that will be modified by the node to incorporate the advanced guidance techniques.

eta

The eta parameter is a floating-point value that influences the strength of the guidance applied to the model. It acts as a scaling factor for the parallel component of the guidance, allowing you to adjust how aggressively the model's predictions are modified. The default value is 1.0, with a minimum of 0.0 and a maximum of 10.0, adjustable in steps of 0.01.

norm_threshold

The norm_threshold parameter is a floating-point value that sets a limit on the magnitude of the guidance applied. It ensures that the guidance does not exceed a certain threshold, which helps in maintaining stability and preventing excessive changes to the model's predictions. The default value is 0.3, with a range from 0.0 to 10.0, adjustable in steps of 0.01.

use_momentum

The use_momentum parameter is a toggle option that allows you to enable or disable the use of momentum in the guidance process. When enabled, it helps in smoothing out the guidance over time, which can lead to more stable and consistent results. The options are "enable" or "disable."

momentum

The momentum parameter is a floating-point value that determines the weight of the previous guidance in the current update when momentum is enabled. It helps in controlling the influence of past guidance on the current predictions, with a default value of 0.05. The range is from -1.00 to 1.00, adjustable in steps of 0.01.

Apply APG CFG Output Parameters:

MODEL

The MODEL output parameter represents the modified AI model after the APG function has been applied. This output is crucial as it contains the updated model that incorporates the advanced guidance techniques, ready for further use or evaluation. The modifications aim to enhance the model's performance by applying controlled and normalized guidance, resulting in more refined outputs.

Apply APG CFG Usage Tips:

  • To achieve subtle adjustments in your model's output, start with a low eta value and gradually increase it to observe the effects on the guidance strength.
  • If you notice instability in the model's predictions, consider enabling use_momentum to smooth out the guidance over time, which can help in achieving more consistent results.
  • Experiment with different norm_threshold values to find the right balance between stability and the desired level of guidance, especially when working with complex models.

Apply APG CFG Common Errors and Solutions:

"MomentumBuffer object has no attribute 'running_average'"

  • Explanation: This error may occur if the momentum buffer is not properly initialized or updated.
  • Solution: Ensure that the use_momentum parameter is set correctly and that the momentum value is within the valid range. Check the initialization of the MomentumBuffer class to confirm that the running_average attribute is correctly set.

"TypeError: unsupported operand type(s) for -: 'NoneType' and 'Tensor'"

  • Explanation: This error can happen if the unconditioned prediction (uncond_pred) is not properly initialized or passed as None.
  • Solution: Verify that the input parameters, especially uncond_pred, are correctly set and not None. Ensure that the model's configuration function is correctly handling all input arguments.

Apply APG CFG Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-APGScaling
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.