Skip to main content

diffusion-rs

Blazingly fast inference of diffusion models.

| Rust Documentation | Python Documentation | Discord |

Features

  • Quantization
    • bitsandbytes format (fp4, nf4, and int8)
    • GGUF (2-8 bit quantization)
  • Easy: Strong support for running 🤗 DDUF models.
  • Strong Apple Silicon support: support for the Metal, Accelerate, and ARM NEON frameworks
  • Support for NVIDIA GPUs with CUDA
  • AVX support for x86 CPUs
  • Allow acceleration of models larger than the total VRAM size with offloading

Please do not hesitate to contact us with feature requests via Github issues!

Upcoming features

  • 🚧 LoRA support
  • 🚧 CPU + GPU inference with automatic offloading to allow partial acceleration of models larger than the total VRAM

Installation

Check out the installation guide for details about installation.

Examples

After installing, you can try out these examples!

Download the DDUF file here: wget https://huggingface.co/DDUF/FLUX.1-dev-DDUF/resolve/main/FLUX.1-dev-Q4-bnb.dduf

CLI:

diffusion_rs_cli --scale 3.5 --num-steps 50 dduf -f FLUX.1-dev-Q4-bnb.dduf

More CLI examples here.

Python:

More Python examples here.

from diffusion_rs import DiffusionGenerationParams, ModelSource, Pipeline
from PIL import Image
import io

pipeline = Pipeline(source=ModelSource.DdufFile("FLUX.1-dev-Q4-bnb.dduf"))

image_bytes = pipeline.forward(
    prompts=["Draw a picture of a sunrise."],
    params=DiffusionGenerationParams(
        height=720, width=1280, num_steps=50, guidance_scale=3.5
    ),
)

image = Image.open(io.BytesIO(image_bytes[0]))
image.show()

Rust crate:

Examples with the Rust crate: here.

use std::time::Instant;

use diffusion_rs_core::{DiffusionGenerationParams, ModelSource, Offloading, Pipeline, TokenSource};
use tracing::level_filters::LevelFilter;
use tracing_subscriber::EnvFilter;

let filter = EnvFilter::builder()
    .with_default_directive(LevelFilter::INFO.into())
    .from_env_lossy();
tracing_subscriber::fmt().with_env_filter(filter).init();

let pipeline = Pipeline::load(
    ModelSource::dduf("FLUX.1-dev-Q4-bnb.dduf")?,
    false,
    TokenSource::CacheToken,
    None,
    None,
)?;

let start = Instant::now();

let images = pipeline.forward(
    vec!["Draw a picture of a sunrise.".to_string()],
    DiffusionGenerationParams {
        height: 720,
        width: 1280,
        num_steps: 50,
        guidance_scale: 3.5,
    },
)?;

let end = Instant::now();
println!("Took: {:.2}s", end.duration_since(start).as_secs_f32());

images[0].save("image.png")?;

Support matrix

Model Supports DDUF Supports quantized DDUF
FLUX.1 Dev/Schnell ✅ ✅

Contributing

  • Anyone is welcome to contribute by opening PRs
  • Collaborators will be invited based on past contributions

Metadata

Release files for diffusion-rs 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for diffusion-rs 0.1.0
File
diffusion_rs-0.1.0-cp312-none-win_amd64.whl CPython 3.12 none Windows x86-64 Details
diffusion_rs-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64 Details
diffusion_rs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
diffusion_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
diffusion_rs-0.1.0-cp311-none-win_amd64.whl CPython 3.11 none Windows x86-64 Details
diffusion_rs-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.39+ x86-64 Details
diffusion_rs-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
diffusion_rs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
diffusion_rs-0.1.0-cp310-none-win_amd64.whl CPython 3.10 none Windows x86-64 Details
diffusion_rs-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.39+ x86-64 Details
diffusion_rs-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
diffusion_rs-0.1.0-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 82.9 MB

Release files / diffusion_rs-0.1.0-cp312-none-win_amd64.whl

Download URL diffusion_rs-0.1.0-cp312-none-win_amd64.whl
Size 5.4 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
0570a8e0cb70ae94a95459a779071ef89d478a6cc6d9740da8cf76eda8a049b4
BLAKE2b-256 checksum
How to use checksums
f25accde9c698785ad6401ad97e93447b444e30d4c6091ee3c60504cf84b315b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL diffusion_rs-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl
Size 8.8 MB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
08fe7d359acb3e08c6ed04c3c1fc82af32fd6c2455bc9acc6d48df2b4c489b75
BLAKE2b-256 checksum
How to use checksums
d016f624135eacf4b528dd7e15542ad31183834923700194ce141bfa25d9e287
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL diffusion_rs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 8.0 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
ad6ecdeb95d6733ab6d5bc89111f0433bea647e9f532485c0ea8ccbc2ea2a565
BLAKE2b-256 checksum
How to use checksums
e2ba1d1e91f34957f38366ae848ed7ba1368a02203152b69095441f5d1040e72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL diffusion_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Size 5.4 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4f432430fc5c32cac77a187989c7f7bdb668549103d77f98e3aac0f8bdbd744d
BLAKE2b-256 checksum
How to use checksums
d0e4adb0eb7ad7df51c64b30934cfdc7266506361c6dba2a048c3a873e5d0a42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp311-none-win_amd64.whl

Download URL diffusion_rs-0.1.0-cp311-none-win_amd64.whl
Size 5.4 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
6479b62382baf42bdf18160504787c9d685f45294472e339fe0f406fc6e60cc3
BLAKE2b-256 checksum
How to use checksums
4ef7c61f839852a985ae18739135ddb3dc2340309c55231e761791c0d1a09fc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl

Download URL diffusion_rs-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl
Size 8.7 MB
Tags CPython 3.11 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
110f1c0bd357e158bae1de361a815576b780d6550291221de7a52aa2e8cfad20
BLAKE2b-256 checksum
How to use checksums
edb4efac28d4649ea4fe20746082b77d118dab68ff0233b5c13b705a84ee36e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL diffusion_rs-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 8.0 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
9f5b71b24e4a1d672930af16817e023e0afc72c4118eede3477d4a301ac06643
BLAKE2b-256 checksum
How to use checksums
fa5742e9fb08cb2b41b1060e071fffe9c48da0e2a8564d57379376391b3f4154
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL diffusion_rs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Size 5.4 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6bfbbc68784773f81980f6e90677ec318c85a60c308c87da87021d8c361becae
BLAKE2b-256 checksum
How to use checksums
abe02fdfc1cc6df633251435025079a88d8a8fa2b22eb07fa226c3641f9824e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp310-none-win_amd64.whl

Download URL diffusion_rs-0.1.0-cp310-none-win_amd64.whl
Size 5.4 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
538de3a4994c5cb634f0ddbde92109bfa19a9232abc139f9ae47b19afa1513c4
BLAKE2b-256 checksum
How to use checksums
4ebac0801b713fe8852d03a993be04c962d3f0a2dfe5ca5d0eebb1a86b105d83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl

Download URL diffusion_rs-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl
Size 8.7 MB
Tags CPython 3.10 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
26958347d98802331948ddb44ea48a1c25d9ea3943353d84b9a5505805614b0f
BLAKE2b-256 checksum
How to use checksums
ca2125ce19356628c59439228f033bbea16f763603407ca0d0695ce2049a5d87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL diffusion_rs-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 8.0 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
31b65637ed35d45dca195664c3d153b93ba42676fb3432459b669768fea9a18d
BLAKE2b-256 checksum
How to use checksums
5dde51e5c74c5c88c8af2deded924f11139ddae2121b7b59a8168bd02477012d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / diffusion_rs-0.1.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL diffusion_rs-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Size 5.4 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c32ddca2a4dbdb692809b94c359f7c83528bb6c3ff4e3d63dd989dcd43967426
BLAKE2b-256 checksum
How to use checksums
f506af68a2b0ffb30452a209dde918aaeb73f596d1f0caae061afcf8d81cbf39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

12 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page