8000 GitHub - nisaruj/comfyui-daam: ComfyUI custom nodes for Diffusion Attentive Attribution Maps (DAAM)
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nisaruj/comfyui-daam

Repository files navigation

ComfyUI DAAM

Download Count Badge

ComfyUI custom nodes for Diffusion Attentive Attribution Maps (DAAM)

This extension enables visualization of cross-attention heatmaps within Stable Diffusion models, showing exactly which parts of the image correspond to specific words in the prompt — good for analyzing and debugging model outputs and LoRA training.

👉 Example workflows are available in workflows.

Sample Workflow

This project was adapted from the SD Web UI implementation. Special thanks to @kousw for the original work!

✨ Features

  • ✅ Positive / Negative prompt heatmap visualization
  • ✅ SDXL, SD1.5, SD3 support
  • ✅ Flux Dev support (Beta)

🚀 Installation

Now Available on Comfy Registry and Custom Node Manager!

Manual Install

Clone this repo into your ComfyUI custom_nodes directory:

git clone https://github.com/nisaruj/comfyui-daam.git

Then install the required packages

cd comfyui-daam
python3 -s -m pip install -r requirements.txt

Restart ComfyUI.

🧩 DAAM Nodes

CLIPTextEncodeWithTokens

Identical to CLIPTextEncode but also outputs the tokenized prompt required for the analysis.

Node: CLIPTextEncodeWithTokens

KSamplerDAAM

A hooked version of KSampler. During sampling, it records attention maps for later analysis.

Outputs:

  • latent — standard latent output
  • pos_heatmaps — positive prompt's raw heatmaps for input into the analyzer
  • neg_heatmaps — negative prompt's raw heatmaps for input into the analyzer

Node: KSamplerDAAM

DAAMAnalyzer

This node generates overlay heatmaps that show which parts of the image correspond to selected words in the prompt.

Inputs:

  • clip — CLIP model used to encode the attention text
  • tokens — from CLIPTextEncodeWithTokens
  • heatmaps — from KSamplerDAAM
  • images — the output images to overlay the heatmaps
  • A text box for comma-separated words to generate heatmaps

Output:

  • A batch of images with word-level heatmaps overlaid

Node: DAAMAnalyzer

📷 Example Output

Prompt: A photo of corgi with a cowboy hat riding a skateboard in the park

Attention words: corgi,skateboard,hat,park

DAAM Result

📦 Changelog

  • 0.4.0

    • Flux and SD3 initial support
    • Code Refactor and Minor bug fixes
  • 0.3.0

    • Negative prompt support
    • Code Refactor and Minor bug fixes
  • 0.2.0

    • Added support for batched inputs
    • SD 1.5 models compatibility
    • Bug fixes and stability improvements
  • 0.1.1

    • Initial Version with SDXL support

About

ComfyUI custom nodes for Diffusion Attentive Attribution Maps (DAAM)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0