Implementing Stable Diffusion in Rust+Torch

149 points l-m-z

sample image of a rusty robot holding a torch

As an example of how to use tch crate, I've put together an implementation of Stable Diffusion in Rust. It mostly follows the lines of huggingface's Python diffusers library and can reuse the original Python weights to generate images from Rust :) Details on GitHub with more rusty robots! Comments/questions are very welcome :)