Stable Diffusion in Rust using Burn. Supports SD 1.5 and 2.1.
Based on diffusers-rs.
Blaze supports this project by providing ultra-fast Apple Silicon macOS Github Action Runners. Apply the discount code AI25 at checkout to enjoy 25% off your first year.
# Using wgpu backend (default, works on most GPUs)
cargo run --release --features wgpu --example stable-diffusion -- \
--prompt "A photo of a rusty robot on a beach"
# Using torch backend
cargo run --release --features torch --example stable-diffusion -- \
--prompt "A photo of a rusty robot on a beach"
# SD 2.1 at 768x768
cargo run --release --features torch --example stable-diffusion -- \
--sd-version v2-1 \
--prompt "A majestic lion on a cliff at sunset"| Feature | Backend |
|---|---|
wgpu |
WebGPU |
torch |
LibTorch |
ndarray |
ndarray |
This crate supports #![no_std] with alloc by disabling the default std feature.
Join our Discord if you want to contribute or have questions!
MIT or Apache-2.0, at your option.