Skip to content

Yet another KandinskySR based on Lachezar Vladikov's solution

Yet another KandinskySR based on Lachezar Vladikov's solution
1200 × 600 · PNG · 24 KB Original file
github.comhttps://github.com/edulov71/ComfyUI-Kandinsky-ImageSR

Lachezar did a great job, but the initial versions were mathematically and logically inefficient, particularly for GPUs with low VRAM like mine, 6 gigs only. So I redesigned it and you can try it by downloading from my GitHub. I'd appreciate if someone would compare it to the latest original solution and other forks on better GPUs where the model + data definitely fit VRAM.

1 points0 comments
Open on Reddit
About this post
Posted
Archived
Score
1 · 100% up
Kind
Image
ID
1yd03ox

Author

2
posts
7
comments
1
media
View profile

1 comment

Key numbers (L40S, warm, per image)

Upscale stage only: median warm ComfyUI execution time minus a LoadImage→SaveImage baseline, batch 1. In production KSR runs each frame of a batch in turn, so a batch of four costs about 4x.

Category Output ESRGAN only Current path KSR 2.7B KSR 4.5B $ ESRGAN $ current $ KSR 2.7B $ KSR 4.5B
WAI Illustrious v17 (SDXL) 1664x2432 1.9 s 7.4 s 3.7 s 4.3 s $0.0010 $0.0040 $0.0020 $0.0023
Anima Aesthetic v1.1 1536x2304 1.8 s 23.6 s 7.3 s 8.8 s $0.0010 $0.0128 $0.0039 $0.0047
Z-Image Turbo 2048x3072 4.9 s 23.9 s 7.1 s 8.6 s $0.0027 $0.0129 $0.0038 $0.0047
Krea 2 Turbo 2184x3264 - 56.2 s 9.5 s 11.3 s - $0.0304 $0.0052 $0.0061

Resident stack (Z-Image, Qwen3 4B TE, VAE) is 24291 MiB. Our q3 (quality medium) tail peaked at 37123 MiB and the same tail with KSR at 40963 MiB, so it can fit in a 48 GB L40S under --gpu-only with room to spare.

Arm Image First run (cold) Warm median Peak VRAM over idle (nvidia-smi) torch peak Per-tile split
esrgan_anime k1 3.4 s 2.4 s 4768 MiB -
esrgan_anime y1 3.1 s 2.8 s 4608 MiB -
esrgan_x4 s1 7.9 s 7.8 s 4704 MiB -
ksr27_c4 k1 9.3 s 4.0 s 7184 MiB 6.35 GiB [encode 0.123, transformer 0.213, decode 0.159, the rest 0.054 s a tile]
ksr27_c4 y1 7.8 s 8.1 s 7216 MiB 6.36 GiB [encode 0.122, transformer 0.213, decode 0.159, the rest 0.053 s a tile]
ksr27_c4 s1 7.7 s 8.1 s 7216 MiB 6.36 GiB [encode 0.124, transformer 0.214, decode 0.160, the rest 0.055 s a tile]
ksr27_c4 h1 11.4 s 11.4 s 7248 MiB 6.38 GiB [encode 0.123, transformer 0.214, decode 0.160, the rest 0.060 s a tile]
ksr45_c4 k1 9.1 s 4.9 s 10704 MiB 9.77 GiB [encode 0.123, transformer 0.342, decode 0.160, the rest 0.058 s a tile]
ksr45_c4 s1 9.7 s 9.7 s 10704 MiB 9.78 GiB [encode 0.122, transformer 0.343, decode 0.161, the rest 0.054 s a tile]
ksr45_c4 h1 13.4 s 13.3 s 10736 MiB 9.79 GiB [encode 0.122, transformer 0.344, decode 0.161, the rest 0.060 s a tile]

Some other details, that I thought may be useful for others:

  • Scale: x1 (enhance), x2 and x4 only. There is no x1.5, we have a 1.5x and would need to x2 plus a downscale.
  • Speed: ≈0.55 s per 1024 px output tile (2.7B) or 0.68 s (4.5B) on a L40S. Per tile: encode 0.12 s, transformer 0.21 s (or 0.34 s), decode 0.16 s.
  • VRAM: 6.4 GiB (2.7B) or 9.8 GiB (4.5B) torch peak, and it does not grow with image size, since tiles run one at a time.

Fork notes:

This fork's only change from upstream is a memory policy for small-VRAM cards, which does not matter on a 48 GB L40S. Its widget default precision is float16 although the README recommends bfloat16, so set it explicitly.

Verdict: mixed. Better for photoreal, not a drop-in for anime

  • Z-Image, photoreal: better. Against today's workflow it gives more natural skin and hair where others like ESRGAN goes waxy, cleaner small faces in the group shot, and straighter sign lettering. Colour does not shift. It costs 7.1 s an image against 4.9 s, about +$0.0012 an image (+9 s for a batch of four). KSR alone is more faithful: the refine changed a letter on the HOTEL sign and added a stray artifact on the portrait. KSR alone is also 3x cheaper.
  • Krea 2, painterly: better on fidelity, much cheaper. Today's q3 latent resample at 0.5 repaints the picture (sign text WOBH became WORN, fur and brushwork were redrawn). KSR keeps the picture and sharpens the brushwork. It takes 9.6 s against 56 s an image.
  • WAI, anime: mixed. KSR keeps line art and lettering well, and at 3.7 s it is faster than the current hires tail (7.4 s). At its default creativity, though, it adds grain to flat cel fills (the festival road, irises, metal) that is off-style for clean anime. Creativity 0 to 2 mostly removes that.
  • Anima, illustration: mixed to slightly worse. Same picture as WAI: crisp lettering but smears some text and adds artifacts, with a paper-like texture in smooth watercolour and skies at creativity 4. It takes 7.3 s against 23.6 s for the current hires tail.
  • Pruned 2.7B vs official 4.5B: visually indistinguishable on these images. The 4.5B is about 25% slower per tile, needs 9.8 GiB of VRAM against 6.4 GiB, and is 7.9 GB on disk against 4.3 GB. Use the 2.7B.

Hope this helps :) Will probably enable it for Z-Image.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.