Extensions/ComfyUI-Kandinsky-Image-SR-2-0
ComfyUI Extension

ComfyUI-Kandinsky-Image-SR-2-0

ComfyUI nodes for Kandinsky ImageSR 2.0: one-step x2/x4 image super-resolution with tiled processing.

By visualbruno·Created a day ago·Updated a day ago· 0
visualbruno/ComfyUI-Kandinsky-Image-SR-2-0
Nodes—
On cloudLocal install
Stars0
Updateda day ago
Readme

ComfyUI-Kandinsky-Image-SR-2-0

ComfyUI nodes for Kandinsky ImageSR 2.0, a one-step diffusion super-resolution model for ×2 and ×4 upscaling. Images are processed in blended tiles, so any input size works.

Installation

Clone this folder into ComfyUI/custom_nodes/ and restart ComfyUI. The only dependency is huggingface_hub, which ComfyUI already installs.

Models

| File | Folder | Size | |---|---|---:| | kandinsky_image_sr_2.0_fp8.safetensors (recommended) | models/diffusion_models | 4.0 GB | | kandinsky_image_sr_2.0_bf16.safetensors | models/diffusion_models | 10.3 GB | | FLUX.1 VAE: ae.safetensors or flux1_vae_bf16.safetensors | models/vae | 0.2 GB |

The model loader downloads a missing transformer from visualbruno/Kandinsky-ImageSR-2.0 the first time it runs. The VAE is the standard FLUX.1 VAE; load it with ComfyUI's Load VAE node.

Nodes

Kandinsky Image SR Model Loader

Loads the transformer. The fp8 file stores the attention and feed-forward weights in ComfyUI's FP8 format (dequantized to bfloat16 for each matmul, so it runs on any CUDA GPU) and gives practically the same images as bf16 with less than half the memory. Both use ComfyUI's model management, so weights are offloaded to system RAM when VRAM runs short.

Kandinsky Image SR Upscale

| Input | Description | |---|---| | model, vae, image | Transformer, FLUX.1 VAE, input image (batches are processed image by image). | | upscale_factor | x2 or x4. | | creativity | Calibrated strength 0–8; 4 is the default. Lower stays closer to the input, higher invents more detail. | | tile_size | Output tile size in pixels (512–1024). The model was trained on 1024; smaller tiles need less VRAM. | | overlap | Overlap between tiles, blended with boundary-aware Hanning windows. | | tile_batch_size | Tiles run through the transformer together: faster with VRAM to spare. |

Creativity levels map to the model's calibrated timesteps:

| Level | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |---|---|---|---|---|---|---|---|---|---| | x2 | 0.07 | 0.086 | 0.118 | 0.134 | 0.15 | 0.18 | 0.21 | 0.27 | 0.30 | | x4 | 0.17 | 0.1885 | 0.207 | 0.2255 | 0.244 | 0.278 | 0.312 | 0.346 | 0.38 |

The upscale runs in three phases per image (encode all tiles, run the transformer, decode and blend), so the VAE and the transformer never need to be in VRAM at the same time.

VRAM

Most of the memory goes to the weights (4.0 GB fp8, 7.6 GB bf16) and to VAE decoding; the transformer itself needs only ~0.3 GB of activations for a 1024 tile. When VRAM is short, ComfyUI keeps part of the weights in system RAM and switches the VAE to tiled decoding, so the default 1024 tiles keep working on small GPUs. Smaller tile_size values lower the activation memory further but change fine texture (the model was trained on 1024 tiles) and make x4 slower, since there are more tiles.

Measured on an RTX 3080 Laptop GPU (16 GB) with a 1024 × 1024 input upscaled x2, with the CUDA allocator capped to emulate smaller GPUs:

| VRAM | fp8 | bf16 | |---|---|---| | 16 GB | 26 s | 33 s | | 6 GB | 29 s | 37 s | | 5 GB | 29 s ¹ | 32 s | | 4 GB | 30 s ¹ | — |

¹ Requires starting ComfyUI with --disable-pinned-memory. With pinned memory enabled, partly offloaded fp8 weights failed with CUDA error: out of memory below 6 GB in this test.

On this image, the fp8 output is within 52 dB PSNR (x2) / 44 dB (x4) of the bf16 reference pipeline; bf16 is within 57 dB (differences come from the attention backend and VAE implementation).

An example workflow is in example_workflows.

License

MIT, as Kandinsky ImageSR 2.0. The transformer code is adapted from the Kandinsky 5 implementation in Diffusers (Apache-2.0).