ClownStyle_Attn_MMDiT
Style transfer at the attention level for Flux, SD3.5 and HiDream
- mask
- blocks
- blocks
This is the attention-layer dial for RES4LYF's style-transfer system, built for MMDiT-architecture models - Flux, SD3.5, HiDream, AuraFlow, Chroma, the dual-stream/single-stream transformer designs that replaced the classic U-Net. You don't use this on its own: you chain it into ClownStyle_UNet's blocks input to push style matching deeper into the network than that node's own proj_in/proj_out taps reach, right down into the query/key/value math itself.
How it works
MMDiT models run image and text tokens through "double" blocks (separate streams that cross-attend) and "single" blocks (streams merged into one). block_type picks which you're targeting. Inside whichever type, this node taps the attention computation directly: q_proj/k_proj/v_proj are the query/key/value projection weights, q_norm/k_norm are the normalization applied to query and key (a detail specific to how MMDiT attention is built - plain U-Net attention doesn't have this step, which is why the sibling ClownStyle_Attn_UNet doesn't expose it), and out is the attention's output projection. Each is a float weight for how hard the chosen mode (the same style-matching algorithm list as ClownStyle_UNet - scattersort, AdaIN, WCT, and friends) gets applied at that specific tap.
The inputs and outputs that matter
mode- which style-matching algorithm runs at the taps you enable. SeeClownStyle_UNetfor what each one does.apply_to(img/img+txt/img,txt/txt) - whether the matching touches image tokens, text tokens, or both. For most style work you want the image tokens involved;txtalone is a narrower, more experimental target.block_type(double/double,single/single) - which block family to hit.block_list(default"all") andblock_weights(default"1.0") - target specific block indices instead of the whole stack, and taper the effect across whichever blocks you picked instead of applying it uniformly.- The six float taps -
q_proj,k_proj,v_proj,q_norm,k_norm,out- all default to 0 (off). These are the actual dials; start with one or two nonzero rather than all six at once, since they compound fast. mask+invert_maskrestrict the effect spatially;tile_h/tile_wonly matter for thetiled_modes.blocks(optional in) chains from an earlierClownStyle_*node; the node's ownblocksoutput chains onward, 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
All six weight floats default to zero. Wiring this node in and seeing no change at all almost always just means you haven't turned any tap on yet - that's the expected starting state, not a bug.
Start at ClownStyle_UNet before reaching for this. This node is deep, per-block tuning on top of the entry-point node's own proj_in/proj_out control. If you haven't already gotten a result you like from the simpler top-level knobs, this is a much bigger search space than you need yet.
A syntax slip in block_list (a stray comma, a bad index range) is the likeliest reason "all" silently stops applying to the blocks you meant to target. If you're not sure, leave it at "all" while you're still dialing in the weight floats, then narrow it down once you know the effect works at all.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | scattersort | 10 options: none, scattersort_dir, scattersort_dir2, scattersort, tiled_scattersort, AdaIN, +4 |
| apply_to | COMBO | img+txt | 4 options: img, img+txt, img,txt, txt |
| block_type | COMBO | single | 3 options: double, double,single, single |
| 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. |
| q_norm | 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_norm | 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 | — |