diffusion-rs-mkl


Namediffusion-rs-mkl 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:41:04
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-mkl",
    "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": "4b57f5ebbdfd20ab6dae73a999f4350b7a314e6e5b866108fccb4ab6fb0b7e1a",
                "md5": "597f6b6747df7efc2a808e4a9d7d2c2a",
                "sha256": "07cf7b646cee1a11b042960c1df1dc53c0015e9493ae49bacad68091a1674ab5"
            },
            "downloads": -1,
            "filename": "diffusion_rs_mkl-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl",
            "has_sig": false,
            "md5_digest": "597f6b6747df7efc2a808e4a9d7d2c2a",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10",
            "size": 12394772,
            "upload_time": "2025-01-07T12:41:04",
            "upload_time_iso_8601": "2025-01-07T12:41:04.069427Z",
            "url": "https://files.pythonhosted.org/packages/4b/57/f5ebbdfd20ab6dae73a999f4350b7a314e6e5b866108fccb4ab6fb0b7e1a/diffusion_rs_mkl-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ae5e52bfa53a14309f394615795d0df7d28b611e9b2074b258189ad835697211",
                "md5": "d595bba0b528853f38442694d27310d7",
                "sha256": "30dc56d39ec67fc15841dacb3d6a3903a71765a03a9dd01812837f513031d144"
            },
            "downloads": -1,
            "filename": "diffusion_rs_mkl-0.1.0-cp310-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "d595bba0b528853f38442694d27310d7",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10",
            "size": 9288453,
            "upload_time": "2025-01-07T12:41:08",
            "upload_time_iso_8601": "2025-01-07T12:41:08.257665Z",
            "url": "https://files.pythonhosted.org/packages/ae/5e/52bfa53a14309f394615795d0df7d28b611e9b2074b258189ad835697211/diffusion_rs_mkl-0.1.0-cp310-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "92c7432dbf1c8e3e7074e77d9cd8db00f001c49eea737ffffb4b30b9c57c5090",
                "md5": "d9d40890fdf5562f922229904507d6a1",
                "sha256": "1d94566250b9c89dcb0a33494947f9323e5e3805900504c3a315b10294eb2262"
            },
            "downloads": -1,
            "filename": "diffusion_rs_mkl-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl",
            "has_sig": false,
            "md5_digest": "d9d40890fdf5562f922229904507d6a1",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10",
            "size": 12394385,
            "upload_time": "2025-01-07T12:41:16",
            "upload_time_iso_8601": "2025-01-07T12:41:16.954421Z",
            "url": "https://files.pythonhosted.org/packages/92/c7/432dbf1c8e3e7074e77d9cd8db00f001c49eea737ffffb4b30b9c57c5090/diffusion_rs_mkl-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab6ce89bf7eeef5b06210bed9ce0db828424b94c600e462dd2a94615232fd5e5",
                "md5": "fbfa885823321d68d237d98ecd8dd1b6",
                "sha256": "32e226eff12eed8b1f482714b870d075275103864559c345092c01d76eb9a5af"
            },
            "downloads": -1,
            "filename": "diffusion_rs_mkl-0.1.0-cp311-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "fbfa885823321d68d237d98ecd8dd1b6",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10",
            "size": 9288499,
            "upload_time": "2025-01-07T12:41:20",
            "upload_time_iso_8601": "2025-01-07T12:41:20.889952Z",
            "url": "https://files.pythonhosted.org/packages/ab/6c/e89bf7eeef5b06210bed9ce0db828424b94c600e462dd2a94615232fd5e5/diffusion_rs_mkl-0.1.0-cp311-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79bff5633fec9cc00b7d149930b500a177d26ae52fc3d8ee51d8ebc84a9c26ea",
                "md5": "40dfbe855dbeac7e3989650ba2107509",
                "sha256": "e74d03b52f9fd2ef4dbe154f80ead08c49a68d597778c5561477e002ec7549e8"
            },
            "downloads": -1,
            "filename": "diffusion_rs_mkl-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl",
            "has_sig": false,
            "md5_digest": "40dfbe855dbeac7e3989650ba2107509",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 12395155,
            "upload_time": "2025-01-07T12:41:24",
            "upload_time_iso_8601": "2025-01-07T12:41:24.978024Z",
            "url": "https://files.pythonhosted.org/packages/79/bf/f5633fec9cc00b7d149930b500a177d26ae52fc3d8ee51d8ebc84a9c26ea/diffusion_rs_mkl-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0cc0624fc1e56da96914de27a07c8d20b3268a3813fa6ecc0f13883e4430197a",
                "md5": "219e88634a455eeec97ea69febde275c",
                "sha256": "8f0ea6d14be598fafc1102d1a116e0a86b3aaec2f17480b4b729dec213e87c80"
            },
            "downloads": -1,
            "filename": "diffusion_rs_mkl-0.1.0-cp312-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "219e88634a455eeec97ea69febde275c",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 9288751,
            "upload_time": "2025-01-07T12:41:28",
            "upload_time_iso_8601": "2025-01-07T12:41:28.489239Z",
            "url": "https://files.pythonhosted.org/packages/0c/c0/624fc1e56da96914de27a07c8d20b3268a3813fa6ecc0f13883e4430197a/diffusion_rs_mkl-0.1.0-cp312-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-07 12:41:04",
    "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-mkl"
}
        
Elapsed time: 0.54342s