by brucethemoose2 · 3y ago · 0 comments
...But Stable Diffusion is not the same. It doesn't quantize as well, the unet is very compute intense, and batched image generation is effective and useful to single users. Its a better fit for GPUs/IGPs. Additionally, it massively benefits from the hackability of the Python implementations.
I think ML compilation to executables is the way for SD. AITemplate is already blazing fast [1], and TVM Vulkan is very promising if anyone will actually flesh out the demo implementation [2]. And they preserve most of the hackability of the pure PyTorch implementations.
But don't get me wrong, I look forward to playing with ggml SD and its development.
The fastest implementation on my 2060 laptop is AITemplate, being about 2x faster than pure optimized HF diffusers.
SD 1.x works in stable-diffusion-web-ui (aka, A1111, one of the more popular frontends) with (reportedly) as little as 2GB of VRAM (I’ve personally used 1.5 and 2.1 without any problems with a 4GB card.)
You can even run CLIP or (if its fast enough) llama.cpp on the CPU to contribute to the network, if you wish.
And only very recent builds of torch 2.1 (with dynamic input) work properly, and it still doesn't like certain input changes, or augmentations like controlnet.
AIT is the most usable compiled implementation I have personally tested, but SHARK (running IREE/MLIR/Vulkan) and torch-mlir are said to be very good.
Hidet is promising but doesn't really work yet. TVM doesn't have a complete implementation outside of the WebGPU demo.
Glad the dynamic stuff is working out tho!
I have been away for a month, but I will start testing it again later and submit some issues I run into.