Stable Diffusion is now available as a Keras implementation, thanks to @divamgupta!
Colab: colab.research.google.com/drive/1zVTa4mL…
Original repo: github.com/divamgupta/sta…
This port has several advantages: (thread)
1. It's extremely readable. Go check out the code yourself! It's only about 500 LoC. I recommend this fork I started which makes the code more idiomatic & adds performance improvements (though the code quality of the original was excellent to start with):
github.com/fchollet/stabl…
2. It's fast. How much faster? It depends on your hardware (try switching on `jit_compile` to see if you can get a greater speedup that way). Benchmark it on your system and let me know!
3. It works out of the box on M1 MacBooPros GPUs. Just install the proper requirements `requirements_m1.txt` and get going.
(This required no extra work on the repo.)
4. It can do TPU inference out of the box: just get a TPU VM and add a TPU strategy scope to the code. This can yield a dramatic speedup (and cost reduction) when doing large-batch inference.
5. It can also do multi-GPU inference out of the box (same, with a MirroredStrategy scope). It just... works.
6. You can export the underlying 3 Keras models to TFLite and TF.js.
This means that you can create AI art apps that run on the device (in the browser, with local GPU acceleration, or on an Android / iOS device, also with local hardware acceleration). No server costs!
Sounds exciting? Go try it, fork it, hack it. And if you want to learn more about what it looks like to work with Keras and TensorFlow, go read the code: github.com/fchollet/stabl…
Huge thanks to @divamgupta for creating this port! This is top-quality work that will benefit everyone doing creative AI.
I'm always amazed by the velocity of the open-source community 👍
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.
