Profile
Back to NewsBack
GitHub Trending 10 min
Reader Mode
kandinskylab/kandinsky-video-sr: Kandinsky 6.0 Video SR: Models for Video Super-Resolution

kandinskylab/kandinsky-video-sr: Kandinsky 6.0 Video SR: Models for Video Super-Resolution

18 hours ago



KandinskyLab Report Kandinsky 6 Kandinsky ImageSR Hugging Face
Diffusers vLLM-Omni SGLang FastVideo ComfyUI

Kandinsky Video Super-Resolution

Tiled video super-resolution for the Kandinsky 6.0 Video pipeline: KVAE encode → latent upscaler → DiT (tiled) → KVAE decode, x2 / x4 / x2.25 upscale of clips up to 15 seconds (361 frames at 24 fps; the model was trained on 5-second clips). Shipped as the kandinsky-6-sr package (import name kandinsky_sr) with the kandy-sr CLI; the Kandinsky 6 pipeline embeds it for generation-then-SR.

For image enhancement and upscaling, see Kandinsky ImageSR 2.0. Demo · Model · GitHub

📰 News

Contents

- Diffusers - GGUF Q8_0 - Manual setup (this repository) - Install - Setup config - GGUF in kandy-sr - Run Inference

Models

Each model is a Diffusers bundle: one repository holds the SR DiT, the KVAE and the x2 / x4 latent upscalers.

| Model | Version | Transformer | Sampling | |---|---|---|---| | Kandinsky-6.0-VSR-2.0-distilled2steps-Diffusers (recommended) | VSR 2.0 | bf16 | π-Flow, 2 steps | | Kandinsky-6.0-VSR-2.0-distilled2steps-GGUF | VSR 2.0 | GGUF Q8_0 | π-Flow, 2 steps | | Kandinsky-6.0-VSR-distilled2steps-5s-Diffusers | VSR 1.0 | bf16 | π-Flow, 2 steps | | Kandinsky-6.0-VSR-5s-Diffusers | teacher | bf16 | flow matching |

🚀 Getting Started

Diffusers

Kandinsky 6.0 VSR ships in 🧨 Diffusers starting from v0.42.0:

pip install "diffusers>=0.42.0" transformers accelerate

Both transformers and accelerate are required to load the pipeline.

[!IMPORTANT]
With the π-Flow models from Models, always pass num_inference_steps=2. They are distilled for exactly 2 model evaluations per tile, but Kandinsky6SRPipeline defaults to 4 steps (the flow-matching setting) and does not take the step count from the bundle, so leaving the argument out runs the model off its trained schedule. kandy-sr and the ComfyUI nodes read it from the bundle and need nothing extra.
import torch
from diffusers import Kandinsky6SRPipeline
from diffusers.utils import export_to_video, load_video

torch._inductor.config.max_autotune = True # required: lets inductor pick flex-attention tiles that fit the SR block mask

pipe = Kandinsky6SRPipeline.from_pretrained( "kandinskylab/Kandinsky-6.0-VSR-2.0-distilled2steps-Diffusers", dtype=torch.bfloat16 ) pipe.enable_model_cpu_offload() pipe.transformer.set_attention_backend("flex") pipe.transformer.compile_repeated_blocks(fullgraph=True)

video = load_video("lq.mp4") # -> list[PIL.Image.Image], 1 + 4k frames (e.g. 121) output = pipe( video=video, resolution_scale=2.25, # 2, 2.25 or 4 num_inference_steps=2, # required, see the note above generator=torch.Generator("cuda").manual_seed(1137), ) export_to_video(output.frames[0], "lq_sr.mp4", fps=24)

With this package installed, call drop_unused_upscaler_modules(pipe.latent_upscaler) (from kandinsky_sr.pipeline.diffusers_upscaler) right after from_pretrained: it frees 2.7 GiB of latent-upscaler weights that inference never uses, and the outputs stay bit-identical. The pruned pipeline is for inference only: don't save_pretrained it.

The Diffusers pipeline is video-only; mux the source audio back in if you need it. A step-by-step version is in notebooks/sr_inference_example_diffusers.ipynb. See the Diffusers Kandinsky 6 docs for details.

GGUF Q8_0

Kandinsky-6.0-VSR-2.0-distilled2steps-GGUF stores the linear weights of the transformer blocks in Q8_0. Its transformer file takes 1.52 GB instead of 3.19 GB. The repository also includes the bf16 VAE and latent upscalers. Diffusers can't load this GGUF on its own, because Kandinsky6SRTransformer3DModel has no from_single_file. Use the loader from this package, which returns a regular Kandinsky6SRPipeline:

pip install "kandinsky-6-sr @ git+https://github.com/kandinskylab/kandinsky-video-sr"
from huggingface_hub import hf_hub_download
from kandinsky_sr.gguf import load_gguf_pipeline

repo = "kandinskylab/Kandinsky-6.0-VSR-2.0-distilled2steps-GGUF" pipe = load_gguf_pipeline(repo, hf_hub_download(repo, "Kandinsky-6.0-VSR-2.0-distilled2steps-Q8_0.gguf"))

then as above: offload, flex attention, compile, num_inference_steps=2

The loader also frees the unused latent-upscaler weights. Weights on the GPU drop from 12.68 to 8.76 GiB, the speed stays the same, and the output matches bf16 within run-to-run noise. A step-by-step version is in notebooks/sr_inference_example_gguf.ipynb.

To upscale many clips in one process, pipe.vae.decoder.compile() makes each next run about 30% faster, at the cost of more peak VRAM and a 15–17 minute first run; see docs/benchmarks.md.

The model also runs in vLLM-Omni, SGLang and FastVideo.

Manual setup (this repository)

The kandy-sr CLI and the kandinsky_sr package run the same bundles with a tiled KVAE that keeps peak VRAM flat at x2 and x4, audio passthrough, delivery-resolution resizing and ComfyUI nodes.

1. Install

Install the package from GitHub. The [flash4] extra adds flash-attn-4, which the optional nabla: cutedsl attention needs:

pip install "kandinsky-6-sr[flash4] @ git+https://github.com/kandinskylab/kandinsky-video-sr"

CUDA 13: pip install "kandinsky-6-sr[flash4-cu13] @ git+https://github.com/kandinskylab/kandinsky-video-sr"

If flash-attn-4 cannot be installed, use flash-attn 2 instead:

pip install "kandinsky-6-sr[flash] @ git+https://github.com/kandinskylab/kandinsky-video-sr"

In a checkout, just setup installs flash-attn-4 and falls back to flash-attn 2.

[Optional] MagiCompiler KVAE backend (vae_backend: magi, Linux with NVIDIA CUDA)

The default split_eager backend needs none of this. The [magi] extra installs the supporting dependencies. MagiCompiler itself is not available on PyPI and must be installed separately from its v1.1.0 Git tag (the older v1.0.0 is not compatible):

pip install "kandinsky-6-sr[magi] @ git+https://github.com/kandinskylab/kandinsky-video-sr"
pip install "setuptools>=61.0" wheel versioningit
pip install --no-build-isolation "magi_compiler @ git+https://github.com/SandAI-org/[email protected]"

Install the system Graphviz executable as well (Ubuntu/Debian: sudo apt install graphviz). In a checkout, just setup-magi installs both the extra and MagiCompiler. For a locally built wheel, replace the first command with pip install "./dist/kandinsky_6_sr--py3-none-any.whl[magi]". Select vae_backend: magi in the config (or pass --vae-backend magi) to enable it.

If a run fails with RuntimeError: CUDA driver error: invalid argument, the MagiCompiler cache holds artifacts built for another GPU / torch build. Point it at a fresh directory: MAGI_COMPILE_CACHE_ROOT_DIR=/path/to/new_cache_dir kandy-sr ....

2. Setup config

# sr_config.yaml
sr:
  checkpoint_path: kandinskylab/Kandinsky-6.0-VSR-2.0-distilled2steps-Diffusers
  resolution_scale: 2      # 2, 4 or 2.25
  device: cuda:0

checkpoint_path takes any bundle from Models, as a Hub repo id (downloaded into the HF cache on first use) or a local copy. It loads the DiT, the KVAE and the latent upscalers at once.

vae_path and latent_upscaler_config are only needed to take those models from somewhere else, e.g. vae_path: kandinskylab/Kandinsky-6.0-VSR-5s-Diffusers/vae. All parameters: Config parameters.

GGUF in kandy-sr

checkpoint_path: kandinskylab/Kandinsky-6.0-VSR-2.0-distilled2steps-GGUF runs the GGUF Q8_0 bundle: the loader finds the .gguf file at the bundle root and keeps the DiT block linears in Q8_0. Its memory is in Required Resources.

3. Run Inference

kandy-sr from-video --config sr_config.yaml --input lq.mp4 --output-dir outputs

any config value can be overridden from the CLI, e.g. the GPU and x4 upscale

kandy-sr from-video --config sr_config.yaml --input lq.mp4 --output-dir outputs \ --device "cuda:0" --resolution-scale 4

To upscale many clips in one process, add --vae-backend split: the first run gets about two minutes longer and each next run a few seconds faster. All backends are in docs/config.md.

--config can be replaced by the KANDY_SR_CONFIG env var; explicit CLI options override the YAML (kandy-sr from-video --help lists them).

From Python (see notebooks/sr_inference_example.ipynb):

from kandinsky_sr.pipeline.factory import load_sr_pipeline

sr_pipeline = load_sr_pipeline("sr_config.yaml", device="cuda:0", force=True) result = sr_pipeline(video=frames_tchw_uint8, source_video="lq.mp4", save_path="outputs/sr.mp4")

Several equal-shaped clips go through in one call: pass video as a [B, T, 3, H, W] tensor (or a list of clips) and save_path / source_video as lists — see notebooks/sr_batch_inference_example.ipynb.

load_sr_pipeline also accepts an SRConfig and an offload= handle, see Required Resources.

ComfyUI

For ComfyUI, install kandinsky6-sr through ComfyUI Manager, then restart ComfyUI. The comfyui/ directory contains extension source code; no manual copying is needed — see the setup guide and manual model downloads.

Required Resources

kandy-sr with its default settings (vae_backend: split_eager, nabla: flex) on one H100 80GB, upscaling a 5-second 864×480 clip (121 frames, 24 fps) to 1728×960 at x2 and 3456×1920 at x4:

| Model | Weights on GPU | Peak VRAM x2 / x4 | First run x2 / x4 | Next runs x2 / x4 | |---|---:|---:|---:|---:| | VSR 2.0, bf16 | 12.75 GiB | 25.8 / 25.8 GiB | 159 / 255 s | 42.6 / 139.7 s | | VSR 2.0, GGUF Q8_0 | 8.87 GiB | 21.9 / 21.9 GiB | 153 / 251 s | 42.7 / 140.5 s | | VSR 2.0, GGUF Q8_0 with offload | 0.03 GiB | 16.3 / 16.3 GiB | 200 / 416 s | 93.1 / 302.5 s |

  • Weights on GPU is what the models keep on the GPU between calls. Peak VRAM is the peak PyTorch allocation during a call, and it already includes the weights.
  • First run is the model load plus the first call, with empty compile caches. Next runs is one more call in the same process.
  • Offload keeps the models in CPU memory and moves only the one the current stage runs (latent upscaler, DiT or KVAE) to the GPU. The kandy-sr CLI has no offload flag: an embedding application such as the Kandinsky 6 pipeline passes any kandinsky_sr.core.utils.offload.OffloadHandle to load_sr_pipeline(..., offload=...), which registers the modules as dit, vae and latent_upscaler. The row was measured with a simple module handle that moves the models for every tile, which makes each run about 2x slower.
docs/benchmarks.md covers every KVAE backend, both attention kernels and the Diffusers pipeline.

Inference Pipeline

SR inference with latent upscaler: latent tiling, per-tile latent upscale, LQ-latent degradation, iterative DiT denoising, KVAE decode, Hanning-blend stitching

The input video is encoded once with the KVAE-3D-2.0-t4s16 video tokenizer and the LQ latent is split into an overlapping tile grid. Each tile is upscaled by the learned latent upscaler (×2 / ×4), mixed with variance-preserving noise (the LQ-latent degradation the model was trained on) and used as the starting point of the denoising loop — the SR DiT predicts the velocity and an Euler step moves the latent towards t→0 (the distilled checkpoint needs 2 evaluations, the flow-matching one a few more). Every denoised tile is KVAE-decoded, and the HQ tiles are stitched back with Hanning-window blending.

Any input resolution works. The latent path needs the clip on the KVAE stride (16 px) and at least one tile wide and high, so the pipeline pads it bottom/right with a mirrored strip before the encode and crops the stitched result back to exactly source × scale — callers never resize or align their videos.

License

This project is licensed under the MIT License. Diffusers export templates retain their Apache-2.0 notices; see LICENSE-APACHE.

Citation

If you use this model in your research or applications, please cite the Kandinsky 6.0 technical report:

@misc{kandinsky2026kandinsky60videofoundation,
      title={Kandinsky 6.0 Video: Foundation Models for Synchronized Video and Audio Generation},
      author={Team Kandinsky},
      year={2026},
      eprint={2610.05608},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2610.05608},
}
Chat with me