ToC
-
Installing diffusion-rs via the CLI requires a few prerequisites:
- Install the Rust programming language
- Follow the instructions on this site: https://rustup.rs/
- (Linux/Mac only) Install OpenSSL (Ubuntu:
sudo apt install libssl-dev
, Brew:brew install openssl
) - (Linux only) Install pkg-config (Ubuntu:
sudo apt install pkg-config
)
- Install the Rust programming language
-
Some models on Hugging Face are gated and require a token to access them:
- Install the necessary tool:
pip install huggingface_hub
- Login:
huggingface_cli login
- Install the necessary tool:
-
Install the
diffusion_rs_cli
CLI
Note
Replace the ...
below with feature flags to build for Nvidia GPUs (CUDA) or Apple Silicon GPUs (Metal)
cargo install diffusion_rs_cli --features ...
- Try the CLI!
Download the DDUF file here:
wget https://huggingface.co/DDUF/FLUX.1-dev-DDUF/resolve/main/FLUX.1-dev-Q4-bnb.dduf
diffusion_rs_cli --scale 3.5 --num-steps 50 dduf -f FLUX.1-dev-Q4-bnb.dduf
-
Installing diffusion-rs via the CLI requires a few prerequisites:
- Install the Rust programming language
- Follow the instructions on this site: https://rustup.rs/
- (Linux/Mac only) Install OpenSSL (Ubuntu:
sudo apt install libssl-dev
, Brew:brew install openssl
) - (Linux only) Install pkg-config (Ubuntu:
sudo apt install pkg-config
)
- Install the Rust programming language
-
Some models on Hugging Face are gated and require a token to access them:
- Install the necessary tool:
pip install huggingface_hub
- Login:
huggingface_cli login
- Install the necessary tool:
-
Clone the repository
git clone https://github.com/EricLBuehler/diffusion-rs.git
cd diffusion-rs
- Install the
diffusion_rs_cli
CLI
Note
Replace the ...
below with feature flags to build for Nvidia GPUs (CUDA) or Apple Silicon GPUs (Metal)
cargo install --path diffusion_rs_cli --release --features ...
- Try the CLI!
Download the DDUF file here:
wget https://huggingface.co/DDUF/FLUX.1-dev-DDUF/resolve/main/FLUX.1-dev-Q4-bnb.dduf
diffusion_rs_cli --scale 3.5 --num-steps 50 dduf -f FLUX.1-dev-Q4-bnb.dduf
-
Installing diffusion-rs via the Python bindings requires a few prerequisites:
- Install the Rust programming language
- Follow the instructions on this site: https://rustup.rs/
- (Linux/Mac only) Install OpenSSL (Ubuntu:
sudo apt install libssl-dev
, Brew:brew install openssl
) - (Linux only) Install pkg-config (Ubuntu:
sudo apt install pkg-config
)
- Install the Rust programming language
-
Some models on Hugging Face are gated and require a token to access them:
- Install the necessary tool:
pip install huggingface_hub
- Login:
huggingface_cli login
- Install the necessary tool:
-
Install the appropriate Python package
Feature | Flag |
---|---|
Nvidia GPUs (CUDA) | pip install diffusion_rs_cuda |
Apple Silicon GPUs (Metal) | pip install diffusion_rs_metal |
Apple Accelerate (CPU) | pip install diffusion_rs_accelerate |
Intel MKL (CPU) | pip install diffusion_rs_mkl |
Use AVX or NEON automatically | pip install diffusion_rs |
- Try the Python bindings!
Download the DDUF file here:
wget https://huggingface.co/DDUF/FLUX.1-dev-DDUF/resolve/main/FLUX.1-dev-Q4-bnb.dduf
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()
-
Installing diffusion-rs via the Python bindings requires a few prerequisites:
- Install the Rust programming language
- Follow the instructions on this site: https://rustup.rs/
- (Linux/Mac only) Install OpenSSL (Ubuntu:
sudo apt install libssl-dev
, Brew:brew install openssl
) - (Linux only) Install pkg-config (Ubuntu:
sudo apt install pkg-config
)
- Install the Rust programming language
-
Some models on Hugging Face are gated and require a token to access them:
- Install the necessary tool:
pip install huggingface_hub
- Login:
huggingface_cli login
- Install the necessary tool:
-
Clone the repository
git clone https://github.com/EricLBuehler/diffusion-rs.git
cd diffusion-rs
- Install the maturin build tool
pip install maturin
- Install the Python bindings
Note
Replace the ...
below with feature flags to build for Nvidia GPUs (CUDA) or Apple Silicon GPUs (Metal)
maturin develop -m diffusion_rs_py/Cargo.toml --release --features ...
- Try the Python bindings!
Download the DDUF file here:
wget https://huggingface.co/DDUF/FLUX.1-dev-DDUF/resolve/main/FLUX.1-dev-Q4-bnb.dduf
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()
-
Installing diffusion-rs for usage as a Rust crate requires a few prerequisites:
- Install the Rust programming language
- Follow the instructions on this site: https://rustup.rs/
- (Linux/Mac only) Install OpenSSL (Ubuntu:
sudo apt install libssl-dev
, Brew:brew install openssl
) - (Linux only) Install pkg-config (Ubuntu:
sudo apt install pkg-config
)
- Install the Rust programming language
-
Some models on Hugging Face are gated and require a token to access them:
- Install the necessary tool:
pip install huggingface_hub
- Login:
huggingface_cli login
- Install the necessary tool:
-
Add the dependency to your
Cargo.toml
- Run:
cargo add diffusion_rs_core
- Alternatively, you can add the git dependency to your Cargo.toml for the latest updates:
diffusion_rs_core = { git = "https://github.com/EricLBuehler/diffusion-rs.git", version = "0.1.0" }
- Run: