Extensions/ComfyUI-NAG-Fixed
ComfyUI Extension

ComfyUI-NAG-Fixed

A patched version of ComfyUI-NAG implementing Normalized Attention Guidance (NAG) for diffusion models with compatibility fixes for the latest ComfyUI version.

By MXM000001·Created about a month ago·Updated about a month ago· 1
MXM000001/ComfyUI-NAG-Fixed
Nodes
On cloudLocal install
Stars1
Updatedabout a month ago
Readme

ComfyUI-NAG-Fixed

ComfyUI-NAG with compatibility fixes for the latest ComfyUI version.

What is this?

This is a patched version of ChenDarYen/ComfyUI-NAG -- a ComfyUI custom node implementing Normalized Attention Guidance (NAG) for diffusion models.

Why does this exist?

The original NAG node uses imports that broke after a ComfyUI refactor. Specifically, DoubleStreamBlock and SingleStreamBlock were moved from comfy.ldm.chroma.layers to comfy.ldm.flux.layers, but the original code still imports from the old (now-None) path.

Fixes applied

  1. Folder renamed: ComfyUI-NAG -> ComfyUI_NAG (Python module names cannot contain hyphens)
  2. chroma/layers.py: from comfy.ldm.chroma.layers -> from comfy.ldm.flux.layers
  3. chroma/model.py: from comfy.ldm.chroma.layers -> from comfy.ldm.flux.layers

All other submodules (flux, sd, sd3, wan, hidream, hunyuan_video) use comfy.ldm.flux.layers directly and work correctly.

Installation

Backup your existing NAG folder first, then: cp -r ComfyUI-NAG-Fixed your_comfyui_path/custom_nodes/ComfyUI_NAG

Then restart ComfyUI. Search for NAG in the node browser.

Credit

Original NAG by ChenDarYen: https://github.com/ChenDarYen/ComfyUI-NAG Paper: https://arxiv.org/abs/2505.21179

License

Same as original project (see LICENSE file).