Nodes/ComfyUI_LucidFlux/LucidFlux_SM_Diffbir
ComfyUI Node

LucidFlux_SM_Diffbir

The DiffBIR preprocessor that decides what your restoration actually sees

By smthemex·Created 11 months ago·Updated 3 months ago· 62
LucidFlux_SM_Diffbir
  • image
  • conditioning
  • image
swinir
width1024
height1024
infer_2kfalse

What it is

LucidFlux_SM_Diffbir is the front end of the pipeline: it takes your degraded input image and turns it into the conditioning the rest of the graph restores against. Its name is a hint - it runs a DiffBIR SwinIR model, specifically general_swinir_v1.ckpt, over your image before anything else happens. Think of it as a "clean the plate" pass: it knocks down noise and compression artifacts so the diffusion stage is repairing real structure instead of hallucinating over garbage.

How it works

Here's the mechanism, grounded in the code. The node loads a SwinIR model (embed_dim=180, 8 blocks, sf=8 upsampler - the classic DiffBIR general restoration config) from models/LucidFlux/. For each input image it builds two conditions:

  • condition_cond - your image normalized to [-1, 1], the LQ (low-quality) condition.
  • condition_cond_ldr - the SwinIR output, also normalized, the LDR condition. That's the pre-cleaned, denoised version of your image.

Both of those get stuffed into the output conditioning that LucidFlux_SM_Encode picks up, and the dual-condition branch of the model injects them at every sampling step. The SwinIR pass is on CPU by default after inference (the node shuttles it on and off the GPU), so this node is where the "restoration" in "universal image restoration" starts doing real work.

The inputs that matter

The inputs that matter:

  • swinir: pick general_swinir_v1.ckpt from models/LucidFlux/. Use the exact file the README links (lxq007/DiffBIR). People have asked which DiffBIR variant works - v2.1 and turbo are not the ones; stick to general_swinir_v1.
  • image: your input. Any IMAGE, straight from LoadImage.
  • width / height: the target output resolution, in 64-pixel steps. This is the resolution the final restore will be, so set it to where you want to end up, not the source size.
  • infer_2k: the 2K path switch. With it off, the image is prepped at full width/height. With it on, it's prepped at half size and the upscale to 2K happens later in the decoder - that's the difference between the 1K and 2K example workflows.

Outputs: conditioning (the LQ/LDR bundle, into Encode) and image (the SwinIR-cleaned image - you can preview it or ignore it; it's the LDR representation and it also gets carried along for color alignment at decode time).

Install

Install is the shared pack story: clone smthemex/ComfyUI_LucidFlux into custom_nodes, pip install -r requirements.txt, restart, then drop general_swinir_v1.ckpt into models/LucidFlux/. That's the whole per-node footprint - it's one of the lightest nodes in the pack, dependency-wise, because SwinIR is small compared to the 12B transformer that comes later.

Two practical notes

Two practical notes. First, the DiffBIR pass is real compute at big sizes - the 2K example runs it at 2048x2048 and it's not instant, but it's milliseconds-class compared to the sampling stage, so don't overthink it. Second, this node is where you should be honest about your source: like every generative restoration tool, LucidFlux rewrites detail, and on a genuinely wrecked or out-of-focus photo the SwinIR pre-clean is what keeps it from inventing noise as structure. Feed it a soft 512px phone snapshot and ask for 2048px and you'll get plausible-but-fictional texture - the same trade every generative upscaler makes, just with a stronger preprocessor. If your image is already sharp and just small, a plain ESRGAN pass is the better tool; this node exists for the damaged-source case.

CategoryLucidFlux_SM

Inputs (5)

NameTypeDefaultDescription
swinirCOMBO1 options: none
imageIMAGE
widthINT1024256–16384
heightINT1024256–16384
infer_2kBOOLEANfalse

Outputs (2)

NameTypeDescription
conditioningCONDITIONING
imageIMAGE