diffusers-rs
Library Listed Dormant
Rust implementation of the Diffusers library using Torch.
- Downloads
- 49
- Dependents
- 1
- Stars
- 596
- Forks
- 65
- Contributors
- 6
- Commits
- 137
- Latest release
- 0.3.1 ·
About
diffusers-rs: A Diffusers API in Rust/Torch

A rusty robot holding a fire torch, generated by stable diffusion using Rust and libtorch.
The diffusers crate is a Rust equivalent to Huggingface's amazing
diffusers Python library.
It is based on the tch crate.
The implementation supports running Stable Diffusion v1.5 and v2.1.
Getting the weights
The weight files can be retrieved from the HuggingFace model repos and should be
moved in the data/ directory.
- For Stable Diffusion v2.1, get the
bpe_simple_vocab_16e6.txt,clip_v2.1.safetensors,unet_v2.1.safetensors, andvae_v2.1.safetensorsfiles from the v2.1 repo. - For Stable Diffusion v1.5, get the
bpe_simple_vocab_16e6.txt,pytorch_model.safetensors,unet.safetensors, andvae.safetensorsfiles from this v1.5 repo. - Alternatively, you can run the following python script.
# Add --sd_version 1.5 to get the v1.5 weights rather than the v2.1.
python3 ./scripts/get_weights.py
Running some example.
cargo run --example stable-diffusion --features clap -- --prompt "A rusty robot holding a fire torch."
Read the full README
The final image is named sd_final.png by default.
The default scheduler is the Denoising Diffusion Implicit Model scheduler (DDIM). The
original paper and some code can be found in the associated repo.
This generates some images of rusty robots holding some torches!






Image to Image Pipeline
The stable diffusion model can also be used to generate an image based on another image. The following command runs this image to image pipeline:
cargo run --example stable-diffusion-img2img --features clap -- --input-image media/in_img2img.jpg
The default prompt is "A fantasy landscape, trending on artstation.", but can
be changed via the -prompt flag.

Inpainting Pipeline
Inpainting can be used to modify an existing image based on a prompt and modifying the part of the
initial image specified by a mask.
This requires different unet weights unet-inpaint.safetensors that could also be retrieved from this
repo and should also be
placed in the data/ directory.
The following command runs this image to image pipeline:
wget https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png -O sd_input.png
wget https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png -O sd_mask.png
cargo run --example stable-diffusion-inpaint --features clap --input-image sd_input.png --mask-image sd_mask.png
The default prompt is "Face of a yellow cat, high resolution, sitting on a park bench.", but can
be changed via the -prompt flag.



ControlNet Pipeline
The ControlNet architecture can be
used to control how stable diffusion generate images. This is to be used with
the weights for stable diffusion 1.5 (see how to get these above). Additional
weights have to be retrieved from this HuggingFace
repo
and copied in data/controlnet.safetensors.
The ControlNet pipeline takes as input a sample image, in the default mode it will perform edge detection on this image using the Canny edge detector and will use the resulting edge image as a guide.
cargo run --example controlnet --features clap,image,imageproc -- \
--prompt "a rusty robot, lit by a fire torch, hd, very detailed" \
--input-image media/vermeer.jpg
The media/vermeer.jpg image is the well known painting on the left hand side,
this results in the right hand side image after performing edge detection.


Using only the edge detection image, the ControlNet model generate the following samples.



FAQ
Memory Issues
This requires a GPU with more than 8GB of memory, as a fallback the CPU version can be used but is slower.
cargo run --example stable-diffusion --features clap -- --prompt "A very rusty robot holding a fire torch." --cpu all
For a GPU with 8GB, one can use the fp16 weights for the UNet and put only the UNet on the GPU.
PYTORCH_CUDA_ALLOC_CONF=garbage_collection_threshold:0.6,max_split_size_mb:128 RUST_BACKTRACE=1 CARGO_TARGET_DIR=target2 cargo run \
--example stable-diffusion --features clap -- --cpu vae --cpu clip \
--unet-weights data/unet-fp16.safetensors
Compatibility
- Runs on
- CUDA
What shows it
- CUDA: diffusers dependency tch
- Native code
- Required
- Binds native code: torch-sys
- Python bindings
- No Python binding crate found
- License
- Apache-2.0 OR MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
Rust implementation of the Diffusers library using Torch. |
49 downloads over 30 days | 1 | 596 | 0.3.1 | CUDA | Binds native code: torch-sys | Apache-2.0 OR MIT |
|
tch-rs Featured
Rust wrappers for the PyTorch C++ api (libtorch). Python bindings |
1,190,464 downloads over 30 days | 124 | 5,518 | 0.26.0 | CUDA | Binds native code: tch, torch-sys. Build uses a native toolchain: cc | Apache-2.0 OR MIT |
|
burn Featured
Flexible and Comprehensive Deep Learning Framework in Rust |
521,465 downloads over 30 days | 391 | 16,257 | 0.22.1 | CUDA, WebGPU, Metal, ROCm, Vulkan | Binds native code: netlink-sys (feature iroh), nvml-wrapper-sys (feature sys-metrics), torch-sys (feature tch) | Apache-2.0 OR MIT |
|
mlx-rs Featured
Unofficial rust wrapper for Apple's mlx machine learning library. |
33,398 downloads over 30 days | 36 | 389 | 0.34.0 | Metal | Binds native code: mach-sys, mlx, mlx-sys. Build uses a native toolchain: bindgen, cc, cmake | Apache-2.0 OR MIT |
|
boostr Listed
ML framework on numr for training and inference on CPU, CUDA and WebGPU: attention, quantization, inference scheduling and distributed execution. Models include LLaMA, Mamba2, Qwen3.5, Whisper, Kokoro, VITS, VoxCPM2, Silero VAD, CLAP and super-resolution. Loads SafeTensors and GGUF. |
1,265 downloads over 30 days | 7 | 20 | 0.11.2 | CUDA, WebGPU | Binds native code: ring (feature distributed) | Apache-2.0 |
|
web-rwkv Listed
An implementation of the RWKV language model in pure WebGPU. |
444 downloads over 30 days | 3 | 360 | 0.10.20 | WebGPU | Binds native code: tracy-client-sys (feature trace) | Apache-2.0 OR MIT |
|
oxidized-transformers Archived
Transformers library (not functional yet) |
0 downloads over 30 days | 0 | 40 | 0.1.1 | CUDA, Metal | No native code found | Apache-2.0 OR MIT |
All projects in Run and serve modelsAll projects in Images and vision
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 0 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 596 stars, 65 forks and 6 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
- The project is dormant and not finished. Dormancy rule
What else the check found
- The last activity is on 2 Jun 2023, 1256 days ago. That reaches the 365 days the rules expect, so the project is dormant. Dormancy rule
- The oldest outside issue waits 1462 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule
Not measured: Latest release fails cargo check.
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.3.1 base 300, raised to the 365-day floor: E = 365 daysdormancy: last activity 2023-06-02, 1256 days ago, E = 365: dormantrot: oldest unanswered issue 1462 days (limit 270), no maintainer reply in 365 daysfeatured: not featured: active_users 0 < 11 and new_adopters 0 < 9 and repository route stars 596 (needs 4539), forks 65 (needs 434), contributors 6 (needs 79); dormant and not stablelisted: listed: no archive, new or featured rule applies
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption0 active dependents, 0 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 0 | crates.io database dump | Yes | |
| New dependents (365 days) | 0 | crates.io database dump | Yes | |
| Peak active dependents | 1 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 3 years ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2023-06-02 | GitHub repository | Yes | |
| Latest release | 2023-05-31 | crates.io database dump | Yes | |
| First release | 2022-11-05 | crates.io database dump | Yes | |
| Latest version | 0.3.1 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 1462 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 0 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution8 releases, 49 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 8 | crates.io database dump | Yes | |
| Downloads over 30 days | 49 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository596 stars, 65 forks, 6 contributors, 137 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 596 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 65 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 6 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 137 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | Apache-2.0 OR MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | CUDA | crates.io database dump | No | |
| What shows each backend | CUDA: diffusers dependency tch | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | Binds native code: torch-sys | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 1 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.