ComfyUI > Nodes > pre_cfg_comfy_nodes_for_ComfyUI > Pre CFG gradient scaling

ComfyUI Node: Pre CFG gradient scaling

Class Name

Pre CFG gradient scaling

Category
model_patches/Pre CFG
Author
Extraltodeus (Account age: 3267days)
Extension
pre_cfg_comfy_nodes_for_ComfyUI
Latest Updated
2024-09-23
Github Stars
0.03K

How to Install pre_cfg_comfy_nodes_for_ComfyUI

Install this extension via the ComfyUI Manager by searching for pre_cfg_comfy_nodes_for_ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter pre_cfg_comfy_nodes_for_ComfyUI 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

Pre CFG gradient scaling Description

Adjust gradients for conditioning precision in model outputs before Classifier-Free Guidance for refined control and creativity.

Pre CFG gradient scaling:

The Pre CFG gradient scaling node is designed to adjust the gradients of your model's conditioning and unconditioning outputs before the Classifier-Free Guidance (CFG) step. This node helps in fine-tuning the influence of the conditioning information on the final output, allowing for more precise control over the generated results. By scaling the gradients, you can enhance or diminish the effect of certain features, leading to more refined and targeted outputs. This is particularly useful in scenarios where you want to emphasize or de-emphasize specific aspects of the generated content, providing you with greater creative control and flexibility.

Pre CFG gradient scaling Input Parameters:

model

This parameter represents the model that will be used for gradient scaling. It is essential as it provides the base structure upon which the gradient adjustments will be applied.

maximum_scale

This parameter sets the upper limit for the gradient scaling. It determines the maximum extent to which the gradients can be scaled. The default value is 80, with a minimum of 0.0 and a maximum of 1000.0. Adjusting this value allows you to control the intensity of the gradient scaling effect.

minimum_scale

This parameter sets the lower limit for the gradient scaling. It determines the minimum extent to which the gradients can be scaled. The default value is 4.5, with a minimum of 0.0 and a maximum of 10.0. This helps in ensuring that the gradients are not scaled down too much, maintaining a baseline influence.

strength

This parameter controls the overall strength of the gradient scaling effect. The default value is 0.5, with a minimum of 0.0 and a maximum of 10.0. Adjusting this value allows you to fine-tune the intensity of the gradient adjustments, providing a balance between the original and scaled gradients.

end_at_sigma

This parameter defines the sigma value at which the gradient scaling effect should end. The default value is 0.28, with a minimum of 0.0 and a maximum of 1000.0. This helps in controlling the duration of the gradient scaling effect, ensuring it is applied only within a specific range.

converging_scales

This boolean parameter determines whether the scales should converge over time. The default value is True. When enabled, the gradient scales will gradually converge, leading to a more uniform effect over time.

invert_mask

This boolean parameter determines whether the mask should be inverted. The default value is False. When enabled, the mask used for gradient scaling will be inverted, altering the areas where the scaling effect is applied.

Pre CFG gradient scaling Output Parameters:

model

The output is the modified model with the applied gradient scaling adjustments. This model will have its gradients scaled according to the specified parameters, resulting in a more controlled and refined output.

Pre CFG gradient scaling Usage Tips:

  • Experiment with the maximum_scale and minimum_scale parameters to find the optimal range for your specific use case.
  • Use the strength parameter to balance the influence of the original and scaled gradients, ensuring the desired effect is achieved.
  • Enable converging_scales for a more uniform gradient scaling effect over time, which can lead to smoother results.
  • Adjust the end_at_sigma parameter to control the duration of the gradient scaling effect, ensuring it is applied only within the desired range.

Pre CFG gradient scaling Common Errors and Solutions:

"Invalid model input"

  • Explanation: The model input provided is not valid or not recognized by the node.
  • Solution: Ensure that the model input is correctly specified and compatible with the gradient scaling node.

"Scale values out of range"

  • Explanation: The specified maximum_scale or minimum_scale values are outside the allowed range.
  • Solution: Adjust the maximum_scale and minimum_scale values to be within the specified range (0.0 to 1000.0 for maximum_scale and 0.0 to 10.0 for minimum_scale).

"Strength value out of range"

  • Explanation: The strength parameter value is outside the allowed range.
  • Solution: Ensure that the strength value is within the specified range (0.0 to 10.0).

"Sigma value out of range"

  • Explanation: The end_at_sigma parameter value is outside the allowed range.
  • Solution: Adjust the end_at_sigma value to be within the specified range (0.0 to 1000.0).

Pre CFG gradient scaling Related Nodes

Go back to the extension to check out more related nodes.
pre_cfg_comfy_nodes_for_ComfyUI
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.