Unet Temperature
The attention-temperature patch that also fixes smudged upscale passes
- model
- Model
- String
Upscale a latent past its native resolution and you get the classic smudge: details go soft, edges blur, the model clearly wasn't built to run its attention over that many tokens. Unet Temperature is the diffusion-side sibling of CLIP Temperature in Extraltodeus's Stable-Diffusion-temperature-settings pack, and it has two jobs. The obvious one is the dial - set the attention temperature inside the denoiser for crisp or creative control. The genuinely useful one is the dynamic scale compensation that tries to fix that smudge by re-deriving the attention scale for whatever resolution you're actually generating at.
How it works
Like its sibling, it's a model patch. It clones your model and replaces the attention function on every layer - self-attention and cross-attention across all input, middle, and output blocks, via set_model_attn1_replace / set_model_attn2_replace. The temperature divides the standard 1/sqrt(d) attention scale, the exact same LLM-temperature trick: lower temperature concentrates attention (sharper details, more decisive composition), higher temperature loosens it.
The interesting half is the dynamic scaling. Diffusion attention uses a fixed scale that assumes the latent is roughly the model's native size. Run the sampler at 256x256 on SDXL, or feed it an upscaled latent for a second pass, and the token count drifts far from training - that mismatch is the well-known smudging issue. (Tiled upscales dodge it by working on small latents, which is why the README notes it doesn't cover them.) The node recognizes your model by size - SD1 at ~1.7B params and SDXL at ~5.1B - and rescales the attention by the log of the actual latent dimension over the layer's native dimension, either before attention (Dynamic_Scale_Temperature) or by scaling the output afterwards (Dynamic_Scale_Output).
The inputs that matter
model- your checkpoint's model; wire it between the loader and the KSampler.Temperature- FLOAT, 0 to 10, default 1 (stock).Attention-both(default),self, orcross. Self is image-to-image attention, cross is text-image; for the smudge fix, self is the one that matters.Dynamic_Scale_Temperature(default off) andDynamic_Scale_Output(default on) - the two rescale stages. Leave output scaling on and SD1/SDXL get the resolution fix with zero effort.
The defaults are genuinely safe. With Dynamic_Scale_Output on, SD1.x and SDXL get the fix automatically. And if you set Temperature to 1 with all dynamic scaling off, the node is a clean pass-through - it literally returns your original model and reports "Fully disabled."
Outputs
Two of them. Model is the patched model - feed it to the KSampler (it's a standard model patch, so you can chain further patches after it). String is a debug summary of what got applied: useful once to confirm the patch took, ignorable forever. Wire it into a text viewer if you want proof.
Installing it
Same story as the whole pack - this node ships in Stable-Diffusion-temperature-settings. In ComfyUI Manager, search for the pack title, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Extraltodeus/Stable-Diffusion-temperature-settings
Then restart. No requirements.txt, no model downloads, nothing heavy - pure torch plus the ComfyUI API. It lives under model_patches/Temperature.
Troubleshooting
The most common confusion is the console line No compatible model detected for dynamic scale attention!. That's not an error - it means your model isn't the recognized SD1/SDXL fingerprint, which Flux and friends will trigger. Plain temperature still applies; you just lose the automatic resolution fix. Second, the shipped node is blunt: it patches every layer at once with no per-layer knobs, even though the README's fancy SD 1.5 example (skipping input 1–2 and output 9–11) was clearly a development-stage proof of concept. And this is a 2024 experiment with thin community discussion, so treat it as a knob to A/B test rather than a guaranteed quality boost. Lower temperature for crisper attention, lean on dynamic scale for cleaner upscale passes, and trust your eyes over the marketing.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| Temperature | FLOAT | 1.000–10 | — |
| Attention | COMBO | 3 options: both, self, cross | |
| Dynamic_Scale_Temperature | BOOLEAN | false | — |
| Dynamic_Scale_Output | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| Model | MODEL | — |
| String | STRING | — |