ClownStyle_Attn_UNet
Style transfer at the attention level for SD1.5 and SDXL
- mask
- blocks
- blocks
The classic-U-Net counterpart to ClownStyle_Attn_MMDiT - same job, different architecture family. This one targets SD1.5, SDXL, Stable Cascade and other models that still run the traditional U-Net (as opposed to the MMDiT transformer designs behind Flux, SD3.5 and HiDream). Like its MMDiT sibling, you don't use it alone: chain it into ClownStyle_UNet's blocks input to push style matching into the attention math itself, deeper than that node's own proj_in/proj_out taps reach.
How it works
Classic U-Net blocks come in three flavors - the downsampling encoder stages (input), the bottleneck (middle), and the upsampling decoder stages (output) - and block_type lets you pick any combination of the three. Within whichever stages you target, this node taps the attention computation: q_proj/k_proj/v_proj are the query/key/value projections and out is the attention's output projection. There's no q_norm/k_norm here the way ClownStyle_Attn_MMDiT has - plain U-Net attention doesn't do that normalization step, so there's nothing to tap. Each float weight controls how hard the chosen mode (the style-matching algorithm - scattersort, AdaIN, WCT, and the rest of the family shared with ClownStyle_UNet) applies at that tap.
The inputs and outputs that matter
mode- which style-matching algorithm runs. SeeClownStyle_UNetfor what each one does.apply_to(self/self,cross/cross) - self-attention is the image attending to itself (composition and texture); cross-attention is the image attending to your text conditioning. Most style bleed happens through self-attention, so that's usually the one worth trying first if you're not sure which to target.block_type(input/middle/output, or any combination) - which U-Net stage(s) to hit.block_list(default"all") andblock_weights(default"1.0") - narrow to specific block indices, and weight the effect differently across whichever ones you pick.- The four float taps -
q_proj,k_proj,v_proj,out- default to 0 (off). Turn on one or two at a time rather than all four together. mask+invert_maskrestrict the effect spatially;tile_h/tile_wonly apply to thetiled_modes.blocks(optional in/out) - chains this node with otherClownStyle_*nodes, feeding ultimately intoClownStyle_UNet.
How to install it
Via ComfyUI Manager, search "RES4LYF". Or:
cd ComfyUI/custom_nodes
git clone https://github.com/ClownsharkBatwing/RES4LYF/
cd RES4LYF
pip install -r requirements.txt
then restart.
Common issues & troubleshooting
Nothing happening at all usually means every weight float is still at its zero default. That's the expected off state, not a broken connection - turn one tap on before judging the effect.
cross not doing much when self clearly does something is normal, not broken. Self-attention carries most of the compositional and textural style information; cross-attention mostly governs how the image reads your prompt, so it's a subtler lever for this specific job.
Reach for this only after ClownStyle_UNet's own controls aren't enough. This is fine-grained, per-block tuning layered on top of a much simpler top-level node - start there, add this when you need more precision than proj_in/proj_out gives you.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | scattersort | 10 options: none, scattersort_dir, scattersort_dir2, scattersort, tiled_scattersort, AdaIN, +4 |
| apply_to | COMBO | self | 3 options: self, self,cross, cross |
| block_type | COMBO | input | 7 options: input, middle, output, input,middle, input,output, middle,output, +1 |
| block_list | STRING | all | — |
| block_weights | STRING | 1.0 | — |
| q_proj | FLOAT | 0.00-100–100 | Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0. |
| k_proj | FLOAT | 0.00-100–100 | Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0. |
| v_proj | FLOAT | 0.00-100–100 | Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0. |
| out | FLOAT | 0.00-100–100 | Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0. |
| tile_h | INT | 12816–10000 | Tile size for tiled modes. Lower values will transfer composition more effectively. Dimensions of image must be divisible by this value. |
| tile_w | INT | 12816–10000 | Tile size for tiled modes. Lower values will transfer composition more effectively. Dimensions of image must be divisible by this value. |
| invert_mask | BOOLEAN | false | — |
| maskopt | MASK | — | |
| blocksopt | BLOCKS | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| blocks | BLOCKS | — |