--- title: LightDiffusion-Next app_file: app.py sdk: gradio sdk_version: 5.20.0 ---
# Say hi to LightDiffusion-Next ๐Ÿ‘‹ [![demo platform](https://img.shields.io/badge/Play%20with%20LightDiffusion%21-LightDiffusion%20demo%20platform-lightblue)](https://huggingface.co/spaces/Aatricks/LightDiffusion-Next)  **LightDiffusion-Next** is the fastest AI-powered image generation GUI/CLI, combining speed, precision, and flexibility in one cohesive tool.

Logo
As a refactored and improved version of the original [LightDiffusion repository](https://github.com/Aatrick/LightDiffusion), this project enhances usability, maintainability, and functionality while introducing a host of new features to streamline your creative workflows. ## Motivation: **LightDiffusion** was originally meant to be made in Rust, but due to the lack of support for the Rust language in the AI community, it was made in Python with the goal of being the simplest and fastest AI image generation tool. That's when the first version of LightDiffusion was born which only counted [3000 lines of code](https://github.com/LightDiffusion/LightDiffusion-original), only using Pytorch. With time, the [project](https://github.com/Aatrick/LightDiffusion) grew and became more complex, and the need for a refactor was evident. This is where **LightDiffusion-Next** comes in, with a more modular and maintainable codebase, and a plethora of new features and optimizations. ๐Ÿ“š Learn more in the [official documentation](https://aatrick.github.io/LightDiffusion/). --- ## ๐ŸŒŸ Highlights ![image](https://github.com/user-attachments/assets/b994fe0d-3a2e-44ff-93a4-46919cf865e3) **LightDiffusion-Next** offers a powerful suite of tools to cater to creators at every level. At its core, it supports **Text-to-Image** (Txt2Img) and **Image-to-Image** (Img2Img) generation, offering a variety of upscale methods and samplers, to make it easier to create stunning images with minimal effort. Advanced users can take advantage of features like **attention syntax**, **Hires-Fix** or **ADetailer**. These tools provide better quality and flexibility for generating complex and high-resolution outputs. **LightDiffusion-Next** is fine-tuned for **performance**. Features such as **Xformers** acceleration, **BFloat16** precision support, **WaveSpeed** dynamic caching, and **Stable-Fast** model compilation (which offers up to a 70% speed boost) ensure smooth and efficient operation, even on demanding workloads. --- ## โœจ Feature Showcase Hereโ€™s what makes LightDiffusion-Next stand out: - **Speed and Efficiency**: Enjoy industry-leading performance with built-in Xformers, Pytorch, Wavespeed and Stable-Fast optimizations, achieving up to 30% faster speeds compared to the rest of the AI image generation backends in SD1.5 and up to 2x for Flux. - **Automatic Detailing**: Effortlessly enhance faces and body details with AI-driven tools based on the [Impact Pack](https://github.com/ltdrdata/ComfyUI-Impact-Pack). - **State Preservation**: Save and resume your progress with saved states, ensuring seamless transitions between sessions. - **Advanced GUI, WebUI and CLI**: Work through a user-friendly graphical interface as GUI or in the browser using Gradio or leverage the streamlined pipeline for CLI-based workflows. - **Integration-Ready**: Collaborate and create directly in Discord with [Boubou](https://github.com/Aatrick/Boubou), or preview images dynamically with the optional **TAESD preview mode**. - **Image Previewing**: Get a real-time preview of your generated images with TAESD, allowing for user-friendly and interactive workflows. - **Image Upscaling**: Enhance your images with advanced upscaling options like UltimateSDUpscaling, ensuring high-quality results every time. - **Prompt Refinement**: Use the Ollama-powered automatic prompt enhancer to refine your prompts and generate more accurate and detailed outputs. - **LoRa and Textual Inversion Embeddings**: Leverage LoRa and textual inversion embeddings for highly customized and nuanced results, adding a new dimension to your creative process. - **Low-End Device Support**: Run LightDiffusion-Next on low-end devices with as little as 2GB of VRAM or even no GPU, ensuring accessibility for all users. - **CFG++**: Uses samplers modified to use CFG++ for better quality results compared to traditional methods. --- ## โšก Performance Benchmarks **LightDiffusion-Next** dominates in performance: | **Tool** | **Speed (it/s)** | |------------------------------------|------------------| | **LightDiffusion with Stable-Fast** | 2.8 | | **LightDiffusion** | 1.9 | | **ComfyUI** | 1.4 | | **SDForge** | 1.3 | | **SDWebUI** | 0.9 | (All benchmarks are based on a 1024x1024 resolution with a batch size of 1 using BFloat16 precision without tweaking installations. Made with a 3060 mobile GPU using SD1.5.) With its unmatched speed and efficiency, LightDiffusion-Next sets the benchmark for AI image generation tools. --- ## ๐Ÿ›  Installation ### Quick Start 1. Download a release or clone this repository. 2. Run `run.bat` in a terminal. 3. Start creating! ### Command-Line Pipeline For a GUI-free experience, use the pipeline: ```bash pipeline.bat ``` Use `pipeline.bat -h` for more options. --- ### Advanced Setup - **Install from Source**: Install dependencies via: ```bash pip install -r requirements.txt ``` Add your SD1/1.5 safetensors model to the `checkpoints` directory, then launch the application. - **โšกStable-Fast Optimization**: Follow [this guide](https://github.com/chengzeyi/stable-fast?tab=readme-ov-file#installation) to enable Stable-Fast mode for optimal performance. - **๐Ÿฆ™ Prompt Enhancer**: Refine your prompts with Ollama: ```bash pip install ollama ollama run deepseek-r1 ``` See the [Ollama guide](https://github.com/ollama/ollama?tab=readme-ov-file) for details. - **๐Ÿค– Discord Integration**: Set up the Discord bot by following the [Boubou installation guide](https://github.com/Aatrick/Boubou). --- ๐ŸŽจ Enjoy exploring the powerful features of LightDiffusion-Next!