ComfyUI Node

sudo latent upscale

Upscale inside the latent before your VAE ever sees it

By styler00dollar·Created 3 years ago·Updated 2 years ago· 40
sudo latent upscale
  • latent
  • LATENT
version

The name is a joke - "sudo," as in giving yourself root access to the latent space. The actual node is less gimmicky than it sounds. SudoLatentUpscale is a neural-net upscaler that takes your 4-channel latent tensor and outputs a 2x larger one, no VAE decode or encode anywhere in the path. It's the direct descendant of city96's SD-Latent-Upscaler and Ttl's NNLatentUpscale, trained up by styler00dollar (the Colab-traiNNer super-resolution guy) with a big pile of modern SR architectures.

Why you'd bother

In a classic hi-res-fix workflow you generate at native res, upscale the decoded image with a pixel upscaler, VAE-encode it back, and run a second KSampler at low denoise to add detail. That round trip is lossy and costs VRAM on the decode/encode. SudoLatentUpscale skips both: feed it the latent straight out of the first KSampler, get a 2x latent back, and wire that into your second KSampler. Same two-pass idea the upscaling essay in this very knowledge base calls the default for anything above native resolution - just done in latent space, where the image never leaves its own representation.

The catch, and read it twice: these models are trained for drawn content. Anime, illustration, stylized art. Point it at a photoreal face and you'll get what a super-resolution net that only saw drawings produces. For anime pipelines it's genuinely the smoother option, since a neural latent upscale lets you get away with a lower denoising strength on pass two than a dumb bilinear latent resize would.

How it works

The pack ships four architectures - SwinFIR, DAT, CRAFT, DRCT - all modified to take 4 input channels (that's the latent tensor's channel count, vs. 3 for RGB) and all fixed at 2x. The author trained separate weights for SD 1.5 and SDXL latent spaces, which is the whole point of the version dropdown. Each run happens in fp32 inside torch.inference_mode(), and the model gets offloaded back to RAM after use, so it's polite to your VRAM between calls. Models auto-download to the node's models/ folder on first use - the source uses wget against the pack's GitHub releases, no HF hub involved.

The inputs that matter

Just two, both required - a genuinely simple node:

  • latent - the LATENT out of your first KSampler (or anything that outputs latents).
  • version - the model picker, 10 entries. The _1.5 ones are for SD 1.5 latents, the _xl ones for SDXL. Mismatch the latent space and it won't look right - a "1.5 model on SDXL latents" mistake is the classic way this produces mush.

The output is a single LATENT, sized 2x, which goes straight into the latent input of a second KSampler (with whatever positive/negative conditioning you're using for pass two).

Which version to pick

The author's own recommendation is SwinFIR or DRCT, and it's easy to see why. SwinFIR is tiny (3.8M params) and fast; DRCT-l is the heavier hitters (~27M) with the more refined end-models. The DRCT-l_12x6_160k_l1_vaeDecode_* variant was trained with extra loss on the VAE-decoded image, so its output tends to stay closer to what pixel-space quality looks like. If in doubt on SDXL, start with SwinFIR4x6_mse_xl for speed, then A/B against a DRCT variant.

Install

Easiest route is ComfyUI Manager - search "ComfyUI-sudo-latent-upscale" and install. Or the manual way:

cd ComfyUI/custom_nodes
git clone https://github.com/styler00dollar/ComfyUI-sudo-latent-upscale
# restart ComfyUI

Dependencies are light (wget, timm), and Manager handles them. The heavy part is the model downloads on first run, so give it a moment the first time you pick a new version.

Where people get burned

  • 2x only. It can't do 4x in one call. Run it twice, or chain it with a pixel upscaler for the rest.
  • First run stalls. It's downloading the .pth from GitHub releases silently via wget - if your machine is offline or proxied, it hangs there.
  • fp32, not fp16. Slightly fatter VRAM than a half-precision op would be, but the models are small and it offloads, so it's rarely a real constraint.
  • Drawn content only. Photoreal users should look at SeedVR2 or an ESRGAN tile path; this one isn't for you, and no amount of denoise tuning fixes that.

Also worth knowing: latent upscaling in general needs a higher denoise floor on pass two than pixel-space upscaling does - community wisdom puts it around 0.3–0.5. A neural latent upscaler like this one lets you go lower than bilinear, but don't expect to run at 0.1 and keep composition intact.

Categorylatent

Inputs (2)

NameTypeDefaultDescription
latentLATENT
versionCOMBO10 options: SwinFIR4x6_mse_1.5, CRAFT7x6_l1_eV2-b0_1.5, DAT6x6_l1_eV2-b0_1.5, DAT12x6_l1_eV2-b0_contextual_1.5, SwinFIR4x6_mse_xl, SwinFIR4x6_fft_l1_xl, +4

Outputs (1)

NameTypeDescription
LATENTLATENT