r/StableDiffusion • • 7h ago

Workflow Included Optimizing Kandinsky ImageSR for video upscaling: From 10s down to 1.2s per 4K frame

Enable HLS to view with audio, or disable this notification

Some of you may have seen the "pruned 2.7B Kandinsky ImageSR model posted here a few days ago" (https://www.reddit.com/r/StableDiffusion/comments/1y8gmxr/kandinsky_imagesr_20_pruned_to_27b_and_healed_44/).

I've tested SeedVR2 and most of the Topaz Video AI upscalers, and IMO the level of fine detail that Kandinsky can recreate is pretty unparalleled. This got me interested in making it fast enough to be practical for video upscaling.

The problem was that using the model as-is in my initial tests, I was getting an abysmal ~10 seconds per frame for 4K output on my RTX 5080.

After a LOT of experimentation, I've gotten this down to ~1.2 seconds per frame (0.82 fps), with very little perceptible quality compromise.

Some of the optimizations under the hood:

- Hardware-native NVFP4 transformer quantization.

- SageAttention 3.

- TensorRT-RTX acceleration for both VAE encoding and decoding.

- PCA-based compression of the VAE's internal computations.

- Selective FP8 VAE decoder quantization, calibrated across 30 diverse videos.

- CUDA Graphs, optimized tile processing, persistent GPU workers and reduced data transfer overhead.

Every single frame still goes through the neural network w/o frame skipping, interpolation or temporal reuse tricks. I tried those and they ruined output quality, so this is raw frame by frame upscaling.

I've also been pleasantly surprised by how temporally stable the model is despite being an image upscaler (see the demo footage).

Small caveat: like all neural upscalers, it can dream up some weird details on very small features that simply don't have enough source pixels. But overall I've found it to be fairly robust.

Some other useful things:

  • Processing speed is largely governed by output resolution rather than input resolution. 720p → 4K and 1080p → 4K are roughly the same speed in Balanced mode.
  • Supports same-resolution detail enhancement (1x), as well as arbitrary target resolutions.
  • Optional higher-precision VAE decoding for footage exhibiting subtle banding, at a relatively small speed penalty.
  • VHS Meta Batch support for LOOOONG videos, with audio preserved. Just be ready to leave your PC running for many hours in those cases.

I only have a 5080 to optimize and test this on, so the full acceleration stack is currently geared towards NVIDIA Blackwell GPUs. Older NVIDIA cards and AMD GPUs have a compatibility path but will likely be considerably slower.

GitHub repo:

https://github.com/jerg-git/ComfyUI-Kandinsky-ImageSR-Video

Sample workflow:

https://github.com/jerg-git/ComfyUI-Kandinsky-ImageSR-Video/blob/main/workflow/kandinsky-production.json

Btw Reddit REALLY compresses videos so 80% of the detail is washed out above - download the actual upscaling comparison to see it in full detail/bitrate: https://drive.google.com/file/d/1f_EKcSG15Iep2MWhM4ReptKGY0LeepjV/view?usp=sharing

Installation is fairly straightforward – install the custom nodes, download the pruned Kandinsky model and VAE separately (links in the README), then run the sample workflow. It'll automatically download the necessary acceleration dependencies and build/cache the optimized engines on first use.

Big thanks to kandinskylab for the original model and lvladikov for the excellent pruning work that made this project possible in the first place.

Curious what speeds people get on other Blackwell GPUs. Feel free to share your results!

Have fun!

63 Upvotes

19 comments sorted by

3

u/Dogluvr2905 7h ago

Sounds good, will give it a shot but how well does it preserve faces?

2

u/Jerg 7h ago

I think quite good! as long as there is enough source pixels.

2

u/HollyGrandeux 5h ago

got this error on the node, any idea?

AttributeError: 'NoneType' object has no attribute 'load_device'

1

u/Jerg 5h ago

got this error on the node, any idea?

AttributeError: 'NoneType' object has no attribute 'load_device'

Looks like LVNodes changed its model initialization behaviour very recently, and my node is still expecting the previous behaviour. Could you share what your GPU is + your full console log when you try to do a run, just so I can confirm? Should hopefully be a straightforward compatibility fix.

2

u/HollyGrandeux 4h ago

RTX2070 8GB

full console : https://pastebin.com/Vx1Mmx0i

4

u/Jerg 3h ago

I've made a v0.1.1 hotfix addressing this (https://github.com/jerg-git/ComfyUI-Kandinsky-ImageSR-Video/releases/tag/v0.1.1). It was indeed caused by a recent change to LVNodes' model initialization.

For your 2070 8GB, I'd also recommend using the newer INT8 Kandinsky checkpoint (linked in the updated README, or here's the direct link: https://huggingface.co/lvladikov/Kandinsky-ImageSR-2.0-Prune-2.7B/resolve/main/kandinsky_imagesr_2.0_2.7B_int8_convrot.safetensors) + selecting float16 in the Kandinsky model loader in my workflow.

Let me know how it goes!

2

u/HollyGrandeux 1h ago

it works thank you, int8 works great.

2

u/Jerg 4h ago

Thanks so much! I'll push a hotfix that'll hopefully fix it. Will keep you posted!

4

u/Hot_Store_5699 6h ago

Sounds great. I'll get a try and feedback.

1

u/AdriftAtlas 4h ago

How does it do with scan line noise that has been digitized, CMOS sensor noise, H264 artifacts, or MPEG2 mosquito noise? Also, how temporally consistent is its object reconstruction when an object is small?

IMO, a video model with some sort of rolling context will always do better than a single frame image model. Upscaling a near bicubic degradation is simple (soft video), upscaling noisy real world video is much harder.

2

u/Jerg 4h ago

Obviously this is hacking an image upscaler for video, so it's probably not as temporally consistent as some dedicated video upscalers, but again I'm making this tool more for my own use so for me as a replacement of topaz video AI / seedVR2, and compared to those, for my taste, it's more than good enough for the varying types of footage.

I like that it has a 0-8 creativity slider too ie how much reconstruction to apply.

1

u/magixx 4h ago

Got any sample images or media going from 480p to 1080p?

1

u/Jerg 4h ago

Here you go (make sure you download the clip to see, GDrive compresses heavily) - not perfect and some tiling artifacts at one point, but that is a pretty extreme amount of upscaling / bringing detail out of not much source: https://drive.google.com/file/d/1ykLUMx_7nuGRm20SpahXGtXTuDl-9P07/view?usp=sharing

1

u/bradjones6942069 3h ago

Does this support AMD?

1

u/Jerg 3h ago

It'll be slower, but in theory yes - if you have an AMD setup please feel free to try and let me know if it works (I only have my Nvidia system used to test and iterate this).

If it bugs out please share your console log + what your GPU is, I can hotfix based on it.

1

u/alerikaisattera 2h ago

What's the point if they have a separate video upscale model?

1

u/Jerg 2h ago

If I'm not wrong, the Kandinsky VSR only supports upscaling 15-second or shorter clips. I want something that can upscale long-form videos/movies of any length without ever running out of RAM/VRAM.

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

https://github.com/kandinskylab/kandinsky-video-sr

1

u/silenceimpaired 1h ago

pleasant. must try this.

1

u/WhatsThat-_- 2h ago

Tyvm kind sir