Find your next open-source project

Search by name, purpose, or keyword, or paste a GitHub URL. Start with / to search agent skills (e.g. /pdf)

kandinskylab/kandinsky-image-sr

Machine LearningVision models

Diffusers pipeline for running Kandinsky Image Super-Resolution 2.0 locally, supporting x1 enhancement and x2/x4 upscaling on CUDA GPUs.

129
8
Python
MIT
3 days old

What It Is

This repository provides a Diffusers-native inference pipeline for the Kandinsky Image Super-Resolution 2.0 model. A single transformer handles both native-resolution enhancement (x1) and x2/x4 upscaling; the BF16 release ships precomputed zero-text conditioning and visual modulation for 26 timesteps, so no text prompt is needed. It is aimed at developers and researchers who want to run the model locally on an NVIDIA GPU, either from Python or the command line.

The model weights live on Hugging Face, with a pinned BF16 revision, a GGUF Q8_0 variant, and a hosted demo for quick trials.

Install

The pipeline depends on the Kandinsky 5 transformer in Diffusers 0.41 or newer. Install the PyTorch wheel matching your CUDA version first, then ImageSR:

# Replace cu128 with the PyTorch wheel index for your CUDA version.
pip install torch --index-url https://download.pytorch.org/whl/cu128
pip install git+https://github.com/kandinskylab/kandinsky-image-sr.git

To work from a clone, just uses uv to create a virtual environment and pick a matching PyTorch build:

git clone https://github.com/kandinskylab/kandinsky-image-sr.git
cd kandinsky-image-sr
just setup        # create .venv
just setup-conda  # or install into the active conda environment

An optional FlashAttention-2 backend can be installed via the flash extra (Linux with CUDA; built from source and requires nvcc).

Run Inference

Load the pinned BF16 revision and pass an input path. Using upscale_factor=4 and the default one_step_t=0.244:

from pathlib import Path

import torch
from kandinsky_image_sr import KandinskyImageSRPipeline
from kandinsky_image_sr.png import save_png

pipe = KandinskyImageSRPipeline.from_pretrained(
    "kandinskylab/Kandinsky-ImageSR-2.0",
    revision="44f95143faaac940723baba66e82ad01e8f0cba7",
    dtype=torch.bfloat16,
).to("cuda")

result = pipe("input.png", upscale_factor=4, one_step_t=0.244)
save_png(result.images[0], Path("output.png"))

The CLI needs a local snapshot of the release; after downloading it into a directory (e.g. ./imagesr-bf16), run:

python scripts/run_inference.py --model ./imagesr-bf16 --input input.png --output output.png \
  --upscale-factor 1 --creativity 4

For x1 enhancement, use upscale_factor=1 with a bundle whose model_index.json includes x1. The creativity level ranges from 0 to 8; level 4 maps to the default t, and lower levels preserve fine text and detail better. An inference notebook and a hosted demo are available for trying the model without local setup.

Constraints

  • The default attention backend is PyTorch SDPA; FlashAttention-2 is opt-in and limited to Linux with CUDA, with the flash extra installed and pipe.transformer.set_attention_backend("flash") called after loading.
  • The CLI defaults to SDPA; --attention flash3 requires a supported Hopper GPU and the flash3 extra.
  • Large images are processed in 1024-pixel output tiles with overlap blending; small inputs are replicate-padded and cropped back to the requested size.
  • Code and model release use the MIT License; the bundled VAE comes from the Apache-2.0 FLUX.1-schnell release.

Performance Notes

The README reports H100 80 GB timings on 1024 × 1024 input with 25% overlap and one tile per call: x1 in 0.327 s uncompiled and 0.172 s compiled, x4 in 7.96 s uncompiled and 4.04 s compiled. Timing excludes PNG export; the compiled configuration uses compiled DiT blocks, a compiled VAE decoder and FlashAttention-3. The optimization docs cover compilation settings and larger-image benchmarks.

HotRepo's take

The project entered HotRepo's new-repository list on 2026-11-29, gaining 6 stars over about one hour (101 → 107) within the Python new list. That is a short, narrow sampling window, so it only shows early attention rather than a trend. The technical case for the repository is concrete: a pinned BF16 revision, a GGUF alternative, measured H100 timings, and an MIT license with an explicitly sourced VAE.

Written by AI from the project's public information and HotRepo's records, updated . The project's own docs are the source of truth.

You might also like

  1. MiniMax-AI/MiniMax-H3-ImageOpen-weights 16-megapixel image generation and editing model with a 33.1B DiT and 6-step sampling.117
  2. speridlabs/idol-sdkTurns a single object image into a standard 3D Gaussian splat on consumer GPUs, for 3D artists, researchers and developers.Python385
  3. opencv/opencvA C++ computer vision library for image processing, video analysis, and machine learning pipelines.C++91,530
  4. Carol-lyh/JeverationRun a frozen vision-language model that generates full images in one forward pass across text-to-image, image-to-image and dense prediction tasks.Python104
  5. OpenMOSS/MOSS-ImageAn open 5B diffusion transformer for text-to-image that keeps text legible and lets you control element placement.Python1,752