Skip to main content

Blazingly fast inference of diffusion models.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

diffusion_rs-0.1.0-cp312-none-win_amd64.whl (5.4 MB view details)

Uploaded CPython 3.12Windows x86-64

diffusion_rs-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl (8.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

diffusion_rs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

diffusion_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

diffusion_rs-0.1.0-cp311-none-win_amd64.whl (5.4 MB view details)

Uploaded CPython 3.11Windows x86-64

diffusion_rs-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

diffusion_rs-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

diffusion_rs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

diffusion_rs-0.1.0-cp310-none-win_amd64.whl (5.4 MB view details)

Uploaded CPython 3.10Windows x86-64

diffusion_rs-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

diffusion_rs-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

diffusion_rs-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file diffusion_rs-0.1.0-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 0570a8e0cb70ae94a95459a779071ef89d478a6cc6d9740da8cf76eda8a049b4
MD5 734f26c122fa9955f324dc08fbdd13f3
BLAKE2b-256 f25accde9c698785ad6401ad97e93447b444e30d4c6091ee3c60504cf84b315b

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 08fe7d359acb3e08c6ed04c3c1fc82af32fd6c2455bc9acc6d48df2b4c489b75
MD5 f313462008f8c2e9e9fe0404286ab6d9
BLAKE2b-256 d016f624135eacf4b528dd7e15542ad31183834923700194ce141bfa25d9e287

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ad6ecdeb95d6733ab6d5bc89111f0433bea647e9f532485c0ea8ccbc2ea2a565
MD5 ff9e2d069a59aeb8c8d14b6179d95a83
BLAKE2b-256 e2ba1d1e91f34957f38366ae848ed7ba1368a02203152b69095441f5d1040e72

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f432430fc5c32cac77a187989c7f7bdb668549103d77f98e3aac0f8bdbd744d
MD5 01f8525f5f2985848066921bb0c317d0
BLAKE2b-256 d0e4adb0eb7ad7df51c64b30934cfdc7266506361c6dba2a048c3a873e5d0a42

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 6479b62382baf42bdf18160504787c9d685f45294472e339fe0f406fc6e60cc3
MD5 c10c37f9f081eb4fa8017fa893b07ca4
BLAKE2b-256 4ef7c61f839852a985ae18739135ddb3dc2340309c55231e761791c0d1a09fc4

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 110f1c0bd357e158bae1de361a815576b780d6550291221de7a52aa2e8cfad20
MD5 8743e44b35ae87981edabc150db3dfe8
BLAKE2b-256 edb4efac28d4649ea4fe20746082b77d118dab68ff0233b5c13b705a84ee36e4

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9f5b71b24e4a1d672930af16817e023e0afc72c4118eede3477d4a301ac06643
MD5 549dda506cd083d2368236c245edbb8d
BLAKE2b-256 fa5742e9fb08cb2b41b1060e071fffe9c48da0e2a8564d57379376391b3f4154

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bfbbc68784773f81980f6e90677ec318c85a60c308c87da87021d8c361becae
MD5 90fed5e78568df49d2a3d8a67da957d4
BLAKE2b-256 abe02fdfc1cc6df633251435025079a88d8a8fa2b22eb07fa226c3641f9824e0

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 538de3a4994c5cb634f0ddbde92109bfa19a9232abc139f9ae47b19afa1513c4
MD5 2042bb465f594f760199be6896b88723
BLAKE2b-256 4ebac0801b713fe8852d03a993be04c962d3f0a2dfe5ca5d0eebb1a86b105d83

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 26958347d98802331948ddb44ea48a1c25d9ea3943353d84b9a5505805614b0f
MD5 c9b89f9b8a1b8eccfc19071ce48c7930
BLAKE2b-256 ca2125ce19356628c59439228f033bbea16f763603407ca0d0695ce2049a5d87

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 31b65637ed35d45dca195664c3d153b93ba42676fb3432459b669768fea9a18d
MD5 56cd692fa0e8a765a6fce1a9e2a73aa1
BLAKE2b-256 5dde51e5c74c5c88c8af2deded924f11139ddae2121b7b59a8168bd02477012d

See more details on using hashes here.

File details

Details for the file diffusion_rs-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for diffusion_rs-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c32ddca2a4dbdb692809b94c359f7c83528bb6c3ff4e3d63dd989dcd43967426
MD5 3df92d22521b423c4e01bc173e84e9cc
BLAKE2b-256 f506af68a2b0ffb30452a209dde918aaeb73f596d1f0caae061afcf8d81cbf39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page