Favicon of Diffusers

Diffusers

A Python library for running diffusion models locally with PyTorch, including Stable Diffusion, LoRA adapters and Apple Silicon support. Apache 2.0 licensed.

Screenshot of Diffusers website

Diffusers is an open-source Python library for developers and researchers who want to run diffusion models on their own hardware or build generation features into an application. It uses PyTorch and supports image, video and audio generation. The library is licensed under Apache 2.0 and supports Apple Silicon.

Its main distinction is how much of a generation system you can replace or reuse. Ready-made pipelines handle inference, while individual pretrained models and interchangeable noise schedulers let you build a custom system or compare tradeoffs in generation speed and output quality. LoRA adapter support lets you use adapted models within those pipelines. You can also train and fine-tune diffusion models.

Image tasks include text-to-image generation, text-guided image editing, inpainting, image variations and super resolution. Supported models and pipelines include Stable Diffusion, ControlNet, InstructPix2Pix, Kandinsky and DeepFloyd IF. Pretrained models are available through the Hugging Face Hub.

Memory use is a practical part of the library's design. Offloading and quantization help larger models fit on devices with limited memory, while torch.compile can speed up inference when memory isn't the constraint. Diffusers also supplies the model components used by projects such as InvokeAI, InstantID and Apple's ml-stable-diffusion.

Similar to Diffusers