Stable-Diffusion-Burn-Wgpu
Stable-Diffusion-Burn is a Rust-based project which ports the V1 stable diffusion model into the deep learning framework, Burn. This repository is licensed under the MIT Licence.
How To Use
Run the Sample Binary
Invoke the sample binary provided in the rust code.
This command will generate an image according to the provided prompt, which will be saved as 'img0.png'.
Optional: Extract and Convert a Fine-Tuned Model
If users are interested in using a fine-tuned version of stable diffusion, the Python scripts provided in this project can be used to transform a weight dump into a Burn model file. Note: the tinygrad dependency should be installed from source rather than with pip.
# Step into the Python directory
# Download the model, this is just the base v1.4 model as an example
# Extract the weights
CPU=1
# Move the extracted weight folder out
# Step out of the Python directory
# Convert the weights into a usable form
The binaries 'convert' and 'sample' are contained in Rust. Convert works on CPU whereas sample needs CUDA.
Remember, convert
should be used if you're planning on using the fine-tuned version of the stable diffusion.
License
This project is licensed under MIT license.
We wish you a productive time using this project. Enjoy!