How to use from the
Use from the
Diffusers library
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline
from diffusers.utils import load_image

# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("WaveCut/Kandinsky-ImageSR-2.0-OrbitQuant-W4A8", dtype=torch.bfloat16, device_map="cuda")

prompt = "Turn this cat into a dog"
input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")

image = pipe(image=input_image, prompt=prompt).images[0]

Kandinsky ImageSR 2.0 β€” OrbitQuant W4A8

OrbitQuant 4-bit weights for Kandinsky ImageSR 2.0, the KandinskyLab diffusion model that restores an image at its own size (Γ—1) or upscales it Γ—2 or Γ—4 in 1024-pixel output tiles, one transformer step per tile. The transformer runs 8-bit activations over 4-bit weights. The 4-bit codes were chosen with GPTQ rounding on 14 DIV2K images that are not in the evaluation set. The FLUX.1 VAE keeps its original weights; OrbitQuant 0.19.0 runs its resnet convolutions and its upsampling as INT8 kernels. The download is 2.2 GB; the original is 8.1 GB.

On one RTX 5090 a Γ—4 upscale from 1024Γ—1024 to 4096Γ—4096 takes 4.67 s with a 5.96 GiB device peak. The compiled BF16 original takes 8.53 s and 10.36 GiB. Γ—2 takes 1.66 s (BF16 3.03 s), Γ—1 takes 0.21 s (BF16 0.41 s).

Upscale time, device memory peak and download size: BF16 original and OrbitQuant W4A8 on an RTX 5090

The inputs are frames of the original card's promo video, cropped and downscaled to 1024 pixels wide, then upscaled Γ—4 to 4096 pixels. Each image shows a 512Γ—512 crop of the output at full resolution. Left to right: the input upscaled with bicubic interpolation, the BF16 original, this release. LPIPS against the BF16 output is in parentheses (lower is closer, see Quality).

Portrait in the snow, hair and snowflakes (0.029): Hair and snowflakes: bicubic, BF16 original and OrbitQuant W4A8

Shop window on a busy street (0.017): Shop window: bicubic, BF16 original and OrbitQuant W4A8

Cloth book spine with lettering (0.013): Book spine: bicubic, BF16 original and OrbitQuant W4A8

Usage

Use Linux, Python 3.12 and an NVIDIA GPU. The tested stack is Torch 2.12.1 with CUDA 13.0 on an RTX 5090.

python3.12 -m venv .venv && . .venv/bin/activate
pip install torch==2.12.1 torchvision==0.27.1 --index-url https://download.pytorch.org/whl/cu130
pip install huggingface_hub
hf download WaveCut/Kandinsky-ImageSR-2.0-OrbitQuant-W4A8 --local-dir kandinsky-image-sr-orbitquant
cd kandinsky-image-sr-orbitquant
pip install -r requirements.txt

requirements.txt installs orbitquant 0.19.0, Diffusers 0.43.0 and the kandinsky_image_sr 1.1.1 runtime, the wheel that the original card installs, pinned to its revision in Kandinsky-ImageSR-2.0-GGUF. The repository holds every component; nothing else is downloaded.

python run_kandinsky_image_sr.py --image photo.png --scale 4 --out photo_x4.png
python run_kandinsky_image_sr.py --image photo.png --scale 1 --creativity 2 --out photo_restored.png

Python, inside kandinsky-image-sr-orbitquant:

from PIL import Image
from kandinsky_image_sr_orbitquant import load_pipeline

pipe = load_pipeline(".")
image = pipe(Image.open("photo.png"), upscale_factor=4).images[0]
image.save("photo_x4.png")

load_pipeline returns the original KandinskyImageSRPipeline with the W4A8 transformer and the INT8 VAE runtime. The pipeline arguments are those of the original card:

  • upscale_factor: 1 (restore at the input size), 2 or 4.
  • creativity: 0 to 8 (default 4), the calibrated denoising strength of each scale.
  • load_pipeline(".", int8_vae=False) or --bf16-vae: keep the BF16 VAE (see Quality and Performance).

The INT8 kernels tune themselves on the first call of each new tile layout and keep the results in the Triton cache on disk. On an empty cache the first Γ—4 upscale of a 1024Γ—1024 image took 124 s; with the cache of an earlier process, the first call of a new process took 14 s. --warmup runs the image once before the timed run. Two processes that upscaled the same image wrote byte-identical PNG files.

Quality

The evaluation set has 12 DIV2K validation images (0801 to 0867, every sixth image) at three scales: Γ—4 and Γ—2 inputs are bicubic downscales of the full image saved as JPEG at quality 85, Γ—1 inputs are 1024Γ—1024 crops blurred by a 2Γ— down-and-up resample and saved as JPEG at quality 60. None of them is a calibration image. Each case ran with creativity 4 and the same seed through the BF16 original and through each variant. LPIPS (AlexNet) and PSNR compare each output with the high-resolution source image (ground truth) and with the BF16 output.

Variant LPIPS to ground truth ↓ PSNR to ground truth, dB ↑ LPIPS to BF16 ↓ PSNR to BF16, dB ↑
BF16 original 0.1684 25.51
W4A8 transformer, round to nearest, BF16 VAE 0.0158 37.28
W4A8 transformer, GPTQ, BF16 VAE 0.1686 25.51 0.0079 41.05
This release: GPTQ, INT8 VAE 0.1687 25.49 0.0107 38.04

The release stays as close to the ground truth as the BF16 original (LPIPS 0.1687 against 0.1684). Its outputs are about 16 times closer to the BF16 outputs (LPIPS 0.0107) than the BF16 outputs are to the ground truth. The quantized transformer with the BF16 VAE gives 0.0079; the INT8 VAE raises it to 0.0107.

By scale (12 images each), LPIPS / PSNR (dB):

Scale BF16 original to ground truth This release to ground truth This release to BF16
Γ—4 0.2227 / 22.72 0.2240 / 22.71 0.0227 / 32.35
Γ—2 0.1299 / 25.73 0.1300 / 25.69 0.0070 / 37.45
Γ—1 0.1526 / 28.08 0.1523 / 28.06 0.0026 / 44.31

Performance

Setup: one RTX 5090 (32 GB, power limit 600 W), Torch 2.12.1, CUDA 13.0, a 1024Γ—1024 crop of DIV2K 0801, creativity 4. Each configuration ran in its own process: a warm-up call, then the best of 2 calls. The time runs from the pipeline call to the finished PIL image. The device peak is the NVML peak of the GPU and includes the CUDA context.

Scale, output BF16 original, compiled This release Speed-up
Γ—4, 4096Γ—4096 (25 tiles) 8.53 s, 10.36 GiB 4.67 s, 5.96 GiB 1.83Γ—
Γ—2, 2048Γ—2048 (9 tiles) 3.03 s, 10.18 GiB 1.66 s, 5.76 GiB 1.82Γ—
Γ—1, 1024Γ—1024 (one tile) 0.411 s, 10.12 GiB 0.209 s, 5.68 GiB 1.97Γ—
  • "Compiled" is the faster configuration of the original card's timing table: torch.compile of the transformer blocks and of the VAE encoder and decoder. Its Γ—4 time splits into VAE encoding 1.03 s, transformer 4.90 s and VAE decoding 2.05 s. The eager BF16 original took 12.7 s for the Γ—4 case in an earlier run on another RTX 5090.
  • The PyTorch allocator peak of this release is 3.9 GiB at Γ—4; the NVML peak adds the CUDA context and the blocks the allocator keeps cached.
  • With the W4A8 transformer and the BF16 VAE, the VAE took about 55 % of the Γ—4 time. In the earlier run on another RTX 5090, the INT8 VAE runtime decoded the 25 tiles of the Γ—4 case in 0.98 s and encoded them in 0.61 s; the torch.compiled BF16 VAE took 2.04 s and 1.03 s (see Components).

Components

Component Original This release Size
Transformer Baked Kandinsky ImageSR transformer, 50 blocks, BF16. The zero-text conditioning and the visual modulation of 26 timesteps are precomputed. The 300 attention and feed-forward projections of the 50 blocks: 4-bit OrbitQuant weights (RPBH rotation, Lloyd-Max codes, GPTQ rounding), INT8 activations. The fused OrbitQuant blocks run QΒ·K attention in INT8. The other parameters are unchanged. 2.03 GB (7.93 GB)
VAE FLUX.1-schnell autoencoder, BF16 Unchanged weights. At load time OrbitQuant replaces, in the encoder and the decoder, the resnet 3Γ—3 convolutions with INT8 implicit-GEMM kernels (per-position activation scales, per-channel weight scales, the residual added in the kernel), the nearest 2Γ— upsampling and its 3Γ—3 convolution with one INT8 sub-pixel convolution, GroupNorm with SiLU with a fused kernel that writes the INT8 input of the next convolution, and the mid-block attention (head dimension 512) with a chunked materialized attention. 0.17 GB

GPTQ used 182 transformer calls on tiles of 14 DIV2K validation images (0872 to 0898, every second image) at the three scales. The rounding lowered the mean relative output error of a projection group from 0.0042 (round to nearest) to 0.00083 (transformer/gptq-info.json). The INT8 VAE decodes one 1024-pixel tile with a PSNR of 52.6 dB against the FP32 VAE (the BF16 VAE: 61.1 dB).

Files

  • transformer/: the packed transformer (model.safetensors), its OrbitQuant codebooks, rotations, quantization configuration and manifest, the original config.json and gptq-info.json (the error of each projection group before and after GPTQ rounding).
  • vae/, model_index.json: the original files.
  • kandinsky_image_sr_orbitquant.py: the loader. run_kandinsky_image_sr.py: the command-line entry point. requirements.txt: the runtime pins.
  • manifest.json: the components, the source revision and the runtime pins. SHA256SUMS: the checksums of all files.
  • LICENSE, LICENSE-FLUX.1-VAE, NOTICE: the licenses and the notice of the modified files.
  • assets/: the chart and images of this card.

Limits and license

  • The release runs one image at a time on CUDA. Tested on an RTX 5090 with Torch 2.12.1 and CUDA 13.0; other GPUs were not tested.
  • The INT8 VAE runtime needs Triton; without it, use --bf16-vae.
  • The evaluation set measures restoration of downscaled and compressed photographs. Other degradations were not measured.

This release is a quantized version of Kandinsky ImageSR 2.0 by KandinskyLab. KandinskyLab did not create, endorse or validate this release. Kandinsky ImageSR 2.0 is released under the MIT License, Copyright (c) 2026 gen-ai-team (LICENSE). Its VAE is the FLUX.1 autoencoder of FLUX.1-schnell, released under the Apache License 2.0 (LICENSE-FLUX.1-VAE). NOTICE lists the modified files.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for WaveCut/Kandinsky-ImageSR-2.0-OrbitQuant-W4A8

Quantized
(7)
this model

Collections including WaveCut/Kandinsky-ImageSR-2.0-OrbitQuant-W4A8