This extension is a WebUI script port of DAAM with compatibility fixes for recent WebUI and Forge backends.
- Attention heatmaps for comma-separated target phrases.
BREAKis also treated as a separator in attention text input.- Dynamic Prompts-aware term resolution for attention targets:
- Nested variants, e.g.
{{bunnygirl outfit|cat girl}|school girl} - Weighted/ranged variants, e.g.
{0.2::red eyes|0.8::blue eyes},{1-2$$ and $$a|b|c} - Sampler-prefixed variants, e.g.
{~hands up|arms crossed},{@a|b} - Wildcards and wildcard globbing, e.g.
__artists__,__artists*__ - Uses Dynamic Prompts parser + wildcard manager when available, with legacy fallback resolver
- Nested variants, e.g.
- Explicit
Enable DAAMtoggle (on/off like other always-on scripts). - Time-focus controls with explicit on/off:
Enable time focus- modes:
Disabled(default),All,Early,Mid,Late,Triplet
Tripletmode rendersEarly + Mid + Latein one run.- Optional diagnostics JSON (
*_daam_diag.json) with per-term match status and reason codes. - Prompt influence modes:
Positive: visualize conditional prompt attention.Negative: visualize unconditional/negative prompt attention.Delta (Pos-Neg):max(0, positive - negative)(suppression-aware positive remainder).Signed Delta (Pos-Neg): signedpositive - negativenormalized to[-1, 1]and mapped to[0, 1].Abs Delta (|Pos-Neg|): absolute difference between positive and negative attention.
- SDXL-compatible prompt token handling.
- Forge-compatible UNet and text-encoder resolution.
- Forge Anima support, including its JointTextEncoder/Qwen + T5 context and per-block heatmaps.
- Grid output mode for multiple attention terms.
Clone into your WebUI/Forge extension directory:
- Open
txt2imgorimg2img. - Expand
Attention Heatmap. - Enable
Enable DAAM. - Enter target terms in
Attention texts for visualization(comma separated). - Generate.
The extension creates blended heatmap images and, if enabled, a grid_daam-*.png in the grid output directory.
Notes:
- Multi-word phrases are matched as one sequence (for example
white dress). - You can separate attention targets with
,orBREAK. - For Dynamic Prompts, DAAM resolves attention templates against the resolved per-image prompt text.
- You can put Dynamic Prompts syntax directly in the DAAM attention box (variants/wildcards); DAAM will try to resolve it to the concrete token used in that image.
- Variable/Jinja-heavy templates are handled best-effort. If a term cannot be uniquely resolved, diagnostics will show a miss reason.
- DAAM normalizes extra-network tags (for example LoRA) for internal token mapping, so LoRA position (start/middle/end) should not change heatmap term matching.
- DAAM heatmaps are generated in the image-save callback (
on_before_image_saved). - In WebUI, keep
Always save all generated imagesenabled. - For API generation, set
"save_images": true; otherwise no DAAM heatmaps are produced. Allmeans one aggregated heatmap over all denoising steps.Tripletmeans three phase heatmaps (Early,Mid,Late) in one generation.- For
Triplet, usingUse grid (output to grid dir)is recommended for easier comparison. Delta (Pos-Neg)can look empty if a term is only present in negative attention (pos <= negeverywhere after clamping).- Use
Signed DeltaorAbs Deltawhen you want to inspect suppression/conflict directly instead of only positive remainder.
DAAM works with Hires Fix and non-latent upscalers (for example 4x-UltraSharp).
For API calls on some Forge builds, include:
"hr_additional_modules": []Without this field, Forge can raise:
TypeError: argument of type 'NoneType' is not iterable
This error originates in Forge processing, not in DAAM logic itself.
ADetailer performs an internal pre-pass postprocess callback before final image saving.
DAAM now defers final cleanup for that dummy callback so heatmaps remain available for the final output save stage.
Current behavior:
- DAAM heatmaps are generated for the main generation pass.
- ADetailer can still change the final image composition after the main pass, so heatmaps should be interpreted as prompt attention guidance, not strict post-inpaint attribution.
DAAM now supports Forge runs with both:
batch_size > 1n_iter (batch count) > 1
The extension no longer depends on Batch pos PNG metadata (which may be absent on Forge).
Instead, it resolves per-image batch positions from processing state and seed/filename fallback logic, and handles compact Forge cond_or_uncond layouts in attention tracing.
It also keeps per-batch prompt analyzers so variable prompts in one batch resolve terms correctly.
To avoid missing heatmaps, keep sample and grid output folders separate.
Recommended:
outdir_txt2img_samples = outputs/txt2img-imagesoutdir_img2img_samples = outputs/img2img-imagesoutdir_txt2img_grids = outputs/txt2img-gridsoutdir_img2img_grids = outputs/img2img-grids
Avoid setting grid dirs to a parent folder that also contains sample dirs (for example outdir_txt2img_grids = outputs with samples in outputs/*), because this can cause grid/sample misclassification in legacy configs.
- Prompt:
A photo of a cute cat wearing sunglasses relaxing on a beach - Attention text:
cat, sunglasses, beach - Output: original + one heatmap per attention term



