Android Stable Diffusion with Snapdragon NPU acceleration. Also supports CPU inference.
This project is now open sourced and completely free. Hope you enjoy it!
If you like it, please consider sponsor this project.
- Download the APK from the Releases page or Google Play.
- Open the app and download the model(s) you want to use
- txt2img
- img2img
- inpaint
It is recommended to build it on linux/wsl. Other platforms are not verified.
Rust, ninja, and cmake are needed for building. You should first install rustup, then "rustup default stable", and then "rustup target add aarch64-linux-android".
git clone --recursive https://github.com/xororz/local-dream.git- Download QNN_SDK_2.29 and extract
- Download Android NDK and extract
- Modify the QNN_SDK_ROOT in app/src/main/cpp/CMakeLists.txt
- Modify the ANDROID_NDK_ROOT in app/src/main/cpp/CMakePresets.json
cd app/src/main/cpp/
bash ./build.sh# winget install Kitware.CMake (install CMake if you don't have it)
# winget install Ninja-build.Ninja (install Ninja if you don't have it)
# winget install Rustlang.Rustup (install Rust if you don't have it)
cd app\src\main\cpp\
# Convert patch file to Unix format (if you don't have dos2unix, install with: winget install -e --id waterlan.dos2unix)
dos2unix SampleApp.patch
.\build.bat# brew install cmake rust ninja (If you are using homebrew)
sed -i '' '2s/$/ -DCMAKE_POLICY_VERSION_MINIMUM=3.5/' build.sh # The default version of homebrew is too high
bash ./build.shopen this project in android studio and click Build/Generate App Bundles or APKs/Generate APKs
- Utilizes Qualcomm QNN SDK to leverage Hexagon NPU
- W8A16 static quantization for optimal performance
- Fixed model shape at 512x512
- Extremely fast inference speed
- Powered by MNN framework
- W8 dynamic quantization
- Flexible output sizes: 128x128, 256x256, 384x384, 512x512
- Relatively slower processing speed with slightly lower accuracy
- Devices with Snapdragon 8 Gen 1
- Devices with Snapdragon 8+Gen 1
- Devices with Snapdragon 8 Gen 2
- Devices with Snapdragon 8 Gen 3
- Devices with Snapdragon 8 Elite
Other devices are not able to download the npu models.
- Requires approximately 2GB RAM
- Compatible with most Android phones from recent years
| Model | Type | CPU | NPU | Clip Skip | Source |
|---|---|---|---|---|---|
| Anything V5.0 | SD1.5 | ✅ | ✅ | 2 | Link |
| ChilloutMix | SD1.5 | ✅ | ✅ | 1 | Link |
| Absolute Reality | SD1.5 | ✅ | ✅ | 2 | Link |
| QteaMix | SD1.5 | ✅ | ✅ | 2 | Link |
| CuteYukiMix | SD1.5 | ✅ | ✅ | 2 | Link |
| Stable Diffusion 2.1 | SD2.1 | - | ✅ | 1 | Link |
| Pony V5.5 | SD2.1 | - | ✅ | 1 | Link |
The application supports custom seed settings for reproducible results:
- CPU Mode: Seeds guarantee identical results across different devices with the same parameters
- NPU Mode: Seeds ensure consistent results only on devices with identical chipsets
- Qualcomm QNN SDK, for executing models on NPU
- alibaba/MNN, for executing models on CPU
- xtensor-stack, for tensor setup and computing, scheduler implementation
- mlc-ai/tokenizers-cpp, for tokenizing user prompt
- yhirose/cpp-httplib, for http-server
- nothings/stb, for image processing
- facebook/zstd, for model patching, reducing download size
- nlohmann/json, for json processing
- coil-kt/coil, for image processing
- MoyuruAizawa/Cropify, for image cropper
- AOSP, Material Design, Jetpack Compose and other projects
If you like this project, please consider sponsoring it. Your support will help me implement:
- Additional models
- New features
- Enhanced capabilities
Your sponsorship helps maintain and improve Local Dream for everyone!

