sd-dynamic-thresholding
Run ComfyUI Easily with InstaSD
Skip the complex setup and run ComfyUI online. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
Available Nodes
DynamicThresholdingSimple
Documentation for DynamicThresholdingSimple Node
Overview
The DynamicThresholdingSimple node is a part of the ComfyUI integration from the Stable Diffusion Dynamic Thresholding (CFG Scale Fix) project. This node is designed to enhance the functionality of Stable Diffusion models by providing a way to use higher Cross-Factor Guided (CFG) Scales without experiencing typical color distortion issues.
Functionality
What This Node Does
The primary task of the DynamicThresholdingSimple node is to implement dynamic thresholding for CFG scales. This process involves clamping latent values between steps during image generation, effectively reducing the unwanted side effects often seen at high CFG scales, such as:
- Color distortion
- Loss of detail
- Unnatural artifacts
This node allows users to leverage higher CFG scales without a decline in image quality. It achieves this by using a dynamic thresholding mechanism that operates during the image generation process, ensuring the output remains visually natural and close to the intended results.
Usage in ComfyUI Workflows
Typical Placement
In a typical ComfyUI workflow, the DynamicThresholdingSimple node is used in tandem with a sampling node, such as KSampler. It is positioned such that it processes the outputs from the model before they are passed to the sampler.
How to Use
-
Installation:
- Ensure ComfyUI is installed and functioning.
- Clone the repository to the ComfyUI custom nodes directory.
- Restart ComfyUI to recognize the new node.
-
Adding the Node:
- In a ComfyUI project, add the DynamicThresholdingSimple node from the list of available nodes.
- Connect the model's output to the input of this node.
- Connect the output from this node to the input of a
KSampleror any equivalent sampler node.
-
Configuration:
- Once placed in the workflow, configure the node according to the specific requirements of your project.
- Adjust any parameters made available within the node's interface to fine-tune the thresholding effect.
Inputs and Outputs
Inputs
- Latents Input: This node accepts latent data; essentially the intermediary data representation that the Stable Diffusion model operates upon. This input is necessary for the node to apply its dynamic thresholding logic.
Outputs
- Processed Latents: The output is the processed latent data which has undergone dynamic thresholding. This data is then passed forward in the workflow to be further processed or sampled to generate the final image.
Special Features and Considerations
-
Compatibility: The node is compatible with any variant of the
KSamplernode used within ComfyUI workflows, as long as they do not completely override internal sampling functions. -
Integration with Other Tools: This node is part of a broader set of tools aimed at improving image generation in Stable Diffusion setups. Its functionality can be further explored in the context of scripts like the Infinity Grid Generator.
-
Installation Note: While specific instructions are given for installation, users should be familiar with the structure and setup of ComfyUI to effectively integrate and utilize this node.
Conclusion
The DynamicThresholdingSimple node is a powerful addition for those working with Stable Diffusion in ComfyUI, addressing common limitations associated with high CFG scales. Its integration is seamless, allowing users to maintain image quality while pushing the boundaries of what CFG scales can achieve in artistic and technical projects.