This repository provides a set of custom nodes for ComfyUI, an interface for Stable Diffusion, that implements dynamic thresholding for CFG scale management. This capability allows users to manage higher CFG scales without encountering color issues, resulting in improved image outputs during the generation process.
The mechanism works by clamping latents between steps, preventing issues typically caused by elevated CFG scales. This repository can also be used within other UIs like SwarmUI and AUTOMATIC1111 Stable Diffusion WebUI.
ComfyUI/custom_nodes
directory of your ComfyUI installation.git clone https://github.com/mcmonkeyprojects/sd-dynamic-thresholding
KSampler's
input.This repository is primarily intended to offer an extension capability for efficiently handling high CFG scales without succumbing to color distortions or anomalies. It provides a way to maintain image quality by controlling the latents during intermediate steps in the image generation process.
The repository contains two types of nodes, each serving a different level of complexity:
These nodes are implemented in __init__.py
as dynthres_comfyui
.
KSampler
node, including custom implementations, provided they do not overwrite the internal sampling function.Implementing dynamic thresholding within ComfyUI workflows enables users to push the boundaries of image generation quality without encountering usual CFG scale limitations. This is particularly beneficial for artists and developers looking to achieve cleaner and more vibrant images by leveraging higher CFG settings.
By adding this mechanism to a workflow, users can expect enhanced control over the visual outcome, maintaining fidelity across different CFG scale configurations.