Stable Diffusion inference via NCNN framework
Top 36.6% on sourcepulse
This project provides a C++ implementation of Stable Diffusion using the ncnn framework, targeting efficient inference on various platforms including x86 (Windows, Linux, macOS) and Android. It supports both text-to-image and image-to-image generation, aiming to offer a performant and resource-conscious alternative for users who need to run Stable Diffusion locally without heavy dependencies.
How It Works
The implementation leverages the ncnn framework, a high-performance neural network inference framework optimized for mobile and embedded devices. It breaks down the Stable Diffusion pipeline into its core components: CLIP for text embedding, a UNet model for iterative sampling, and an AutoencoderKL for latent space manipulation. The use of ncnn allows for optimized operations and dynamic shape support, enabling flexibility in resolution while maintaining efficiency.
Quick Start & Requirements
assets
folder, configure magic.txt
, and run stable-diffusion.exe
.build/assets
. Run ./stable-diffusion-ncnn
.*-fp16.bin
) are required.Highlighted Details
txt2img
and img2img
functionalities.Maintenance & Community
The project appears to have recent updates (March 2023) adding img2img capabilities for Android and x86. Links to Zhihu and Bilibili are provided for more detailed explanations and demonstrations.
Licensing & Compatibility
The README does not explicitly state a license. It mentions compliance with the Stable Diffusion model agreement and requests notification for open-source projects using its ONNX models. Commercial use implications are not detailed.
Limitations & Caveats
The Android APK is noted to be slow and power-consuming, requiring 7GB of RAM. The project relies on external model weights ("Naifu") which are not included and must be sourced separately. The project statement requests users not to use it for illegal purposes.
2 years ago
1 day