GradientPatchModelAddDownscale (Kohya Deep Shrink)
Deep Shrink that fades in instead of snapping — the smoother Kohya Deep Shrink
- model
- MODEL
The name says it all
If you've ever pushed an SD 1.5 checkpoint past ~1536px and watched it grow a second head, you've met the problem this node exists for. Deep Shrink is the old trick for generating big images without the duplicate-anatomy freakout: run the early denoising steps on a downscaled latent so the composition locks in at a resolution the model was actually trained on, then finish at full resolution. ComfyUI ships that as the built-in PatchModelAddDownscale (Kohya Deep Shrink) node. This pack is a modded fork of it - same idea, but the downscale factor ramps smoothly back to full resolution instead of snapping on and off.
The name is a mild lie in the other direction: it's all local. No API, no key, no model downloads. One Python file and torch.
What it does and where it sits
It's a MODEL → MODEL patcher. You wire it between your checkpoint (and LoRA stack) and the KSampler; out comes a patched model that samples identically except for what happens inside one block of the UNet.
Mechanically: the node patches a specific UNet input block. When the current sampling step maps to a percent below start_percent, the block's features are downscaled by 1/downscale_factor. Between start_percent and end_percent the scale factor interpolates linearly up to 1.0. Past end_percent, full resolution. The percentages are converted into the sampler's sigma schedule via percent_to_sigma, so "0.35" means 35% of the way through denoising regardless of your step count. An output block patch stretches the features back to the size the next block expects, so the rest of the network sees normal-shaped tensors. The interpolation is hardcoded bicubic.
Here's the part that's actually different from stock: the built-in node downscales fully for the whole window, then jumps back to full res in one step. That jump is where people see the seam - blurry structure that suddenly snaps into detail. This node fades it, which is exactly what the author (kinfolk0117) set out to do when he modded the built-in and posted the results to r/StableDiffusion back in late 2023.
The inputs that matter
- block_number (3): which UNet input block to shrink. 3 is the classic spot the built-in uses; higher numbers go deeper and subtler.
- downscale_factor (2): how much to shrink at peak. 2 = half resolution.
- end_percent (0.35): when the fade completes. This is your main lever - push it later (0.4–0.5) to keep the low-res phase longer on very big images.
start_percent (0) and downscale_after_skip (true) you can leave alone; patching after the skip connection is the standard deep-shrink wiring. The single output is a MODEL, straight into your KSampler.
Installing it
ComfyUI Manager: search GradientDeepShrink. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/kinfolk0117/ComfyUI_GradientDeepShrink
Then restart ComfyUI. No requirements.txt, no models to fetch, nothing beyond what ComfyUI already ships. It lands under the _for_testing category in the node menu - that's just the category the author picked, not a warning label.
Where people get burned
- The error
'ModelPatcher' object has no attribute 'set_model_input_block_patch_after_skip'appears on ComfyUI installs that predate that core method. Update ComfyUI itself, not this pack. - This is a single commit from December 2023, never touched since. It forks a built-in that has since grown (the core node now even lets you pick interpolation methods). When a ComfyUI update drifts, there's nobody coming to fix this - that's literally what happened to users in the author's announcement thread, who found both this and the built-in dead after an update.
- On SD1.5 pushed to 2k–3k, the author himself flagged foggy eyes as a side effect.
Honest take: on SDXL or anything modern, skip this entirely - models trained at higher native resolution don't need the crutch, and deep shrink as a concept faded with them. For SD 1.5 people pushing 1536–2048px who find the built-in's hard switch ugly, it's a genuine improvement. Niche node for a legacy trick, but it does its one thing well.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| block_number | INT | 31–32 | — |
| downscale_factor | FLOAT | 2.0000.1–9 | — |
| start_percent | FLOAT | 0.0000–1 | — |
| end_percent | FLOAT | 0.3500–1 | — |
| downscale_after_skip | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |