diffusion-rs-cuda


Namediffusion-rs-cuda JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/EricLBuehler/diffusion-rs
SummaryBlazingly fast inference of diffusion models.
upload_time2025-01-07 12:40:18
maintainerNone
docs_urlNone
authorEric Buehler
requires_python>=3.10
licenseMIT
keywords machine-learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <a name="top"></a>
<h1 align="center">
  diffusion-rs
</h1>

<h3 align="center">
Blazingly fast inference of diffusion models.
</h3>

<p align="center">
| <a href="https://ericlbuehler.github.io/diffusion-rs/diffusion_rs_core/"><b>Rust Documentation</b></a> | <a href="https://ericlbuehler.github.io/diffusion-rs/pyo3/diffusion_rs.html"><b>Python Documentation</b></a> | <a href="https://discord.gg/DRcvs6z5vu"><b>Discord</b></a> |
</p>


## Features
- Quantization
  - `bitsandbytes` format (fp4, nf4, and int8)
  - `GGUF` (2-8 bit quantization)
- Easy: Strong support for running [🤗 DDUF](https://huggingface.co/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](https://github.com/EricLBuehler/diffusion-rs/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](INSTALL.md) for details about installation.

## Examples
After [installing](#installation), 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:**
```bash
diffusion_rs_cli --scale 3.5 --num-steps 50 dduf -f FLUX.1-dev-Q4-bnb.dduf
```

More CLI examples [here](diffusion_rs_cli/README.md).

**Python:**

More Python examples [here](diffusion_rs_py/examples).

```py
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](diffusion_rs_examples/examples).

```rust
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
  - See [good first issues](https://github.com/EricLBuehler/diffusion-rs/labels/good%20first%20issue) for a starting point!
- Collaborators will be invited based on past contributions


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/EricLBuehler/diffusion-rs",
    "name": "diffusion-rs-cuda",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "machine-learning",
    "author": "Eric Buehler",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "<a name=\"top\"></a>\n<h1 align=\"center\">\n  diffusion-rs\n</h1>\n\n<h3 align=\"center\">\nBlazingly fast inference of diffusion models.\n</h3>\n\n<p align=\"center\">\n| <a href=\"https://ericlbuehler.github.io/diffusion-rs/diffusion_rs_core/\"><b>Rust Documentation</b></a> | <a href=\"https://ericlbuehler.github.io/diffusion-rs/pyo3/diffusion_rs.html\"><b>Python Documentation</b></a> | <a href=\"https://discord.gg/DRcvs6z5vu\"><b>Discord</b></a> |\n</p>\n\n\n## Features\n- Quantization\n  - `bitsandbytes` format (fp4, nf4, and int8)\n  - `GGUF` (2-8 bit quantization)\n- Easy: Strong support for running [\ud83e\udd17 DDUF](https://huggingface.co/DDUF) models.\n- Strong Apple Silicon support: support for the Metal, Accelerate, and ARM NEON frameworks\n- Support for NVIDIA GPUs with CUDA\n- AVX support for x86 CPUs\n- Allow acceleration of models larger than the total VRAM size with offloading\n\nPlease do not hesitate to contact us with feature requests via [Github issues](https://github.com/EricLBuehler/diffusion-rs/issues)!\n\n## Upcoming features\n- \ud83d\udea7 LoRA support\n- \ud83d\udea7 CPU + GPU inference with automatic offloading to allow partial acceleration of models larger than the total VRAM\n\n## Installation\nCheck out the [installation guide](INSTALL.md) for details about installation.\n\n## Examples\nAfter [installing](#installation), you can try out these examples!\n\n> Download the DDUF file here: `wget https://huggingface.co/DDUF/FLUX.1-dev-DDUF/resolve/main/FLUX.1-dev-Q4-bnb.dduf`\n\n**CLI:**\n```bash\ndiffusion_rs_cli --scale 3.5 --num-steps 50 dduf -f FLUX.1-dev-Q4-bnb.dduf\n```\n\nMore CLI examples [here](diffusion_rs_cli/README.md).\n\n**Python:**\n\nMore Python examples [here](diffusion_rs_py/examples).\n\n```py\nfrom diffusion_rs import DiffusionGenerationParams, ModelSource, Pipeline\nfrom PIL import Image\nimport io\n\npipeline = Pipeline(source=ModelSource.DdufFile(\"FLUX.1-dev-Q4-bnb.dduf\"))\n\nimage_bytes = pipeline.forward(\n    prompts=[\"Draw a picture of a sunrise.\"],\n    params=DiffusionGenerationParams(\n        height=720, width=1280, num_steps=50, guidance_scale=3.5\n    ),\n)\n\nimage = Image.open(io.BytesIO(image_bytes[0]))\nimage.show()\n```\n\n**Rust crate:**\n\nExamples with the Rust crate: [here](diffusion_rs_examples/examples).\n\n```rust\nuse std::time::Instant;\n\nuse diffusion_rs_core::{DiffusionGenerationParams, ModelSource, Offloading, Pipeline, TokenSource};\nuse tracing::level_filters::LevelFilter;\nuse tracing_subscriber::EnvFilter;\n\nlet filter = EnvFilter::builder()\n    .with_default_directive(LevelFilter::INFO.into())\n    .from_env_lossy();\ntracing_subscriber::fmt().with_env_filter(filter).init();\n\nlet pipeline = Pipeline::load(\n    ModelSource::dduf(\"FLUX.1-dev-Q4-bnb.dduf\")?,\n    false,\n    TokenSource::CacheToken,\n    None,\n    None,\n)?;\n\nlet start = Instant::now();\n\nlet images = pipeline.forward(\n    vec![\"Draw a picture of a sunrise.\".to_string()],\n    DiffusionGenerationParams {\n        height: 720,\n        width: 1280,\n        num_steps: 50,\n        guidance_scale: 3.5,\n    },\n)?;\n\nlet end = Instant::now();\nprintln!(\"Took: {:.2}s\", end.duration_since(start).as_secs_f32());\n\nimages[0].save(\"image.png\")?;\n```\n\n## Support matrix\n| Model | Supports DDUF | Supports quantized DDUF |\n| -- | -- | -- |\n| FLUX.1 Dev/Schnell | \u2705 | \u2705 |\n\n## Contributing\n\n- Anyone is welcome to contribute by opening PRs\n  - See [good first issues](https://github.com/EricLBuehler/diffusion-rs/labels/good%20first%20issue) for a starting point!\n- Collaborators will be invited based on past contributions\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Blazingly fast inference of diffusion models.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/EricLBuehler/diffusion-rs",
        "Source Code": "https://github.com/EricLBuehler/diffusion-rs"
    },
    "split_keywords": [
        "machine-learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad54b19894645e6572bb233c4b1b485482baef5699599847dde39e6a94d30200",
                "md5": "daffdbda86611e91a92a27d0dd2f9887",
                "sha256": "662caa6a99e2b5ce1def83356d033fbde42fbfa19e19e3417db056e5867545ef"
            },
            "downloads": -1,
            "filename": "diffusion_rs_cuda-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl",
            "has_sig": false,
            "md5_digest": "daffdbda86611e91a92a27d0dd2f9887",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10",
            "size": 10943464,
            "upload_time": "2025-01-07T12:40:18",
            "upload_time_iso_8601": "2025-01-07T12:40:18.965290Z",
            "url": "https://files.pythonhosted.org/packages/ad/54/b19894645e6572bb233c4b1b485482baef5699599847dde39e6a94d30200/diffusion_rs_cuda-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08f763cc55b9c94cffbc9953612008e8d7d60d11caa6e5a9a3f2fe092e64ed92",
                "md5": "771c632bfb6cbd65238950b9cd0a09ee",
                "sha256": "a06d67feb7d595072c9f7f21ec0c807ee21266dbf961d8efad3e7d5bf5ce5b9e"
            },
            "downloads": -1,
            "filename": "diffusion_rs_cuda-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl",
            "has_sig": false,
            "md5_digest": "771c632bfb6cbd65238950b9cd0a09ee",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10",
            "size": 10942485,
            "upload_time": "2025-01-07T12:40:27",
            "upload_time_iso_8601": "2025-01-07T12:40:27.557437Z",
            "url": "https://files.pythonhosted.org/packages/08/f7/63cc55b9c94cffbc9953612008e8d7d60d11caa6e5a9a3f2fe092e64ed92/diffusion_rs_cuda-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e6dac262d0be9c9aa8058180110d5ed004d14431f92a4db263b2325fd3c63a9e",
                "md5": "77d8cc861b5d2f9ea5912ade908a715b",
                "sha256": "59182e563296639fa5f6bf6e43a8406ca51deb55230110deaa4eef3f9642674c"
            },
            "downloads": -1,
            "filename": "diffusion_rs_cuda-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl",
            "has_sig": false,
            "md5_digest": "77d8cc861b5d2f9ea5912ade908a715b",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 10946786,
            "upload_time": "2025-01-07T12:40:32",
            "upload_time_iso_8601": "2025-01-07T12:40:32.647184Z",
            "url": "https://files.pythonhosted.org/packages/e6/da/c262d0be9c9aa8058180110d5ed004d14431f92a4db263b2325fd3c63a9e/diffusion_rs_cuda-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-07 12:40:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "EricLBuehler",
    "github_project": "diffusion-rs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "diffusion-rs-cuda"
}
        
Elapsed time: 0.65163s