stable-diffusion-burn  by Gadersd

Rust port of Stable Diffusion v1.4

created 2 years ago
338 stars

Top 82.6% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This project provides a Rust implementation of the Stable Diffusion v1.4 model, leveraging the burn deep learning framework. It targets developers and researchers interested in exploring or deploying diffusion models within the Rust ecosystem, offering a performant and memory-efficient alternative to Python-based solutions.

How It Works

The project directly ports the Stable Diffusion v1.4 architecture into Rust, utilizing the burn framework for tensor operations and automatic differentiation. This approach aims to provide native performance and memory safety benefits inherent to Rust, while burn's design facilitates backend flexibility (CUDA, MPS, WGPU) and efficient execution.

Quick Start & Requirements

  • Install: cargo run --release --bin sample burn SDv1-4 7.5 20 "An ancient mossy stone." img [cuda|mps|cpu]
  • Prerequisites: libtorch v2.4.1, at least 6 GB VRAM for CUDA.
  • Model Download: wget https://huggingface.co/Gadersd/Stable-Diffusion-Burn/resolve/main/SDv1-4.mpk
  • Fine-tuning Conversion: Requires Python 3, tinygrad, and a .ckpt model file. Conversion script is not compatible with Windows.
  • Links: HuggingFace Model

Highlighted Details

  • Native Rust implementation of Stable Diffusion v1.4.
  • Supports CUDA, MPS (Apple Silicon), and CPU backends via burn.
  • Includes Python scripts for converting fine-tuned models to burn's format.

Maintenance & Community

No specific community channels or contributor information is provided in the README.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: Permissive license allows for commercial use and integration into closed-source projects.

Limitations & Caveats

The WGPU backend is explicitly marked as unstable. Model conversion scripts are not compatible with Windows. The sample binary requires CUDA for execution, while convert works on CPU.

Health Check
Last commit

10 months ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
7 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Jaret Burkett Jaret Burkett(Founder of Ostris), and
1 more.

nunchaku by nunchaku-tech

2.1%
3k
High-performance 4-bit diffusion model inference engine
created 9 months ago
updated 1 day ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems) and Ying Sheng Ying Sheng(Author of SGLang).

fastllm by ztxz16

0.4%
4k
High-performance C++ LLM inference library
created 2 years ago
updated 2 weeks ago
Feedback? Help us improve.