Nodes Browser

ComfyDeploy: How Semantic-aware Guidance (S-CFG) works in ComfyUI?

What is Semantic-aware Guidance (S-CFG)?

ComfyUI node for Semantic-aware Guidance based on the [a/paper](https://arxiv.org/abs/2404.05384) 'Rethinking the Spatial Inconsistency in Classifier-Free Diffusion Guidance'

How to install it in ComfyDeploy?

Head over to the machine page

  1. Click on the "Create a new machine" button
  2. Select the Edit build steps
  3. Add a new step -> Custom Node
  4. Search for Semantic-aware Guidance (S-CFG) and select it
  5. Close the build step dialig and then click on the "Save" button to rebuild the machine

Semantic-aware Guidance (S-CFG)

ComfyUI node for Semantic-aware Guidance based on the paper "Rethinking the Spatial Inconsistency in Classifier-Free Diffusion Guidance"

Paper | Code | sd-webui-incantations <sup>(SD-WebUI extension)</sup>

Dynamically rescale CFG guidance per semantic region to a uniform level to improve image / text alignment.

Other details:

  • Computationally expensive. Large resolutions (like on an upscale pass) can trigger OOM.
  • made to work with other resolutions
  • made to work with SDXL (based on guesswork, since the original paper/code didn't mention SDXL)
  • only works for models with a U-Net backbone (i.e. SD1.x - SDXL)
  • uses sampler_cfg_function (there can only be one node active using this, so it may conflict with other nodes using the same thing)

Installation

You can either:

  • In a termnial, run: git clone https://github.com/shiimizu/ComfyUI-semantic-aware-guidance.git into your ComfyUI/custom_nodes/ folder.

  • Install it via ComfyUI Manager (search for custom node named "s-cfg").