ClownGuide AttnInj (HiDream)
Style transfer through attention injection
- guide
- mask
- weights
- guides
- guides
AttnInj is the heavier-handed sibling of the AdaIN style guide. Instead of matching a reference's feature statistics, it reaches into the model's attention and injects the reference's queries, keys, and values directly. That's a stronger, more structural way to transfer a look - it can carry over not just color and tone but the way forms and edges are put together. It targets MMDiT models, HiDream especially.
Same guide framework as the rest of the pack: this node doesn't produce an image, it builds a GUIDES bundle that plugs into the sampler's guides input and steers denoising toward a reference during sampling. Guides chain - you can stack this after other guides via the guides passthrough - and the sampler applies the whole stack. AttnInj is the "get in there and rewrite attention" link.
How it works
Attention inside a transformer is built from three projections: query (Q), key (K), and value (V). This node takes those from your reference (the guide latent) at selected blocks and blends them into the generation's attention, on the image side and/or the text side. Value injection is the default emphasis - img_v starts at 1 while the query and key weights start at 0 - because V tends to carry "what the content looks like" while Q and K govern "what attends to what," so leaning on V transfers appearance with fewer structural surprises. The per-projection norm controls exist for finer shaping.
The inputs and outputs that matter
You will not touch most of the two dozen parameters. The ones that matter:
guide(LATENT, optional) - the reference to inject from. The point of the node.weight(FLOAT, default1) - overall injection strength.img_v/img_q/img_kand thetxt_*equivalents (FLOAT) - how much of each projection to inject on the image and text streams. Defaults lean onimg_v; nudge these before anything else if you want more or less transfer.double_blocks/single_blocks(STRING) - which transformer blocks to inject at (defaults: double0,1,3, single20).weight_scheduler,start_step/end_step,mask/invert_mask- the standard guide scheduling, step window, and regional controls shared across the family.
Output is a guides (GUIDES) bundle for the next guide or the sampler.
How to install it
ComfyUI Manager: search RES4LYF, install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/ClownsharkBatwing/RES4LYF/, pip install -r requirements.txt in the venv (portable: embedded python's pip), restart, hard-refresh F5. Load a HiDream (or other supported MMDiT) checkpoint. Nested sampler menu wants rgthree-comfy with "Auto Nest Subdirectories" on.
Common issues
Attention injection is powerful and therefore easy to overdo. Push the weights too high and the reference stops being an influence and starts being the output - you'll get the source image's structure bleeding through your prompt, sometimes as ghosting or doubled forms. If the result looks like a bad double-exposure, back the img_*/txt_* weights down.
Because there are so many dials, resist the urge to move several at once. The whole pack suffers from thin documentation and "it depends on the image" is the real answer to most settings questions, so a fixed seed and one-variable-at-a-time is the only sane way to learn what each projection does. And the shared scheduler warning applies: bong_tangent ignores the workflow's shift and runs its own, so if scheduling seems off, switch to beta57 or constant. If you only need a light stylistic nudge, the AdaIN guide is easier to control - reach for AttnInj when you specifically want strong, structural transfer.
Inputs (25)
| Name | Type | Default | Description |
|---|---|---|---|
| weight | FLOAT | 1.00-100–100 | Set the strength of the guide by multiplying all other weights by this value. |
| weight_scheduler | COMBO | constant | 12 options: constant, simple, sgm_uniform, karras, exponential, ddim_uniform, +6 |
| double_blocks | STRING | 0,1,3 | — |
| double_weights | STRING | 1.0 | — |
| single_blocks | STRING | 20 | — |
| single_weights | STRING | 0.5 | — |
| img_q | FLOAT | 0.00-100–100 | Set relative injection strength. |
| img_k | FLOAT | 0.00-100–100 | Set relative injection strength. |
| img_v | FLOAT | 1.00-100–100 | Set relative injection strength. |
| txt_q | FLOAT | 0.00-100–100 | Set relative injection strength. |
| txt_k | FLOAT | 0.00-100–100 | Set relative injection strength. |
| txt_v | FLOAT | 0.00-100–100 | Set relative injection strength. |
| img_q_norm | FLOAT | 0.00-100–100 | Set relative injection strength. |
| img_k_norm | FLOAT | 0.00-100–100 | Set relative injection strength. |
| img_v_norm | FLOAT | 0.00-100–100 | Set relative injection strength. |
| txt_q_norm | FLOAT | 0.00-100–100 | Set relative injection strength. |
| txt_k_norm | FLOAT | 0.00-100–100 | Set relative injection strength. |
| txt_v_norm | FLOAT | 0.00-100–100 | Set relative injection strength. |
| start_step | INT | 00–10000 | — |
| end_step | INT | 15-1–10000 | — |
| invert_mask | BOOLEAN | false | — |
| guideopt | LATENT | — | |
| maskopt | MASK | — | |
| weightsopt | SIGMAS | — | |
| guidesopt | GUIDES | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| guides | GUIDES | — |