{"id":25004346,"url":"https://github.com/xororz/local-dream","last_synced_at":"2026-04-24T07:01:58.277Z","repository":{"id":274187764,"uuid":"922050275","full_name":"xororz/local-dream","owner":"xororz","description":"Run Stable Diffusion on Android Devices with Snapdragon NPU acceleration. Also supports CPU/GPU inference.","archived":false,"fork":false,"pushed_at":"2025-10-06T14:52:44.000Z","size":13254,"stargazers_count":512,"open_issues_count":30,"forks_count":22,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-10-06T16:33:29.362Z","etag":null,"topics":["img2img","inpainting","stable-diffusion","stable-diffusion-android","txt2img"],"latest_commit_sha":null,"homepage":"https://play.google.com/store/apps/details?id=io.github.xororz.localdream","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xororz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-25T07:14:07.000Z","updated_at":"2025-10-06T14:37:29.000Z","dependencies_parsed_at":"2025-01-25T15:23:52.954Z","dependency_job_id":"255c5890-6b90-4b48-866a-ce920ec5f2cf","html_url":"https://github.com/xororz/local-dream","commit_stats":null,"previous_names":["xororz/local-dream"],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/xororz/local-dream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xororz%2Flocal-dream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xororz%2Flocal-dream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xororz%2Flocal-dream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xororz%2Flocal-dream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xororz","download_url":"https://codeload.github.com/xororz/local-dream/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xororz%2Flocal-dream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001529,"owners_count":26083117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["img2img","inpainting","stable-diffusion","stable-diffusion-android","txt2img"],"created_at":"2025-02-04T23:52:16.786Z","updated_at":"2026-04-21T07:03:36.232Z","avatar_url":"https://github.com/xororz.png","language":"Kotlin","funding_links":["https://ko-fi.com/xororz"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Local Dream \u003cimg src=\"./assets/icon.png\" width=\"32\" alt=\"Local Dream\"\u003e\n\n**Android Stable Diffusion with Snapdragon NPU acceleration**  \n_Also supports CPU/GPU inference_\n\n\u003cimg src=\"./assets/demo1.jpg\" alt=\"App Demo\" width=\"800\"\u003e\n\n\u003c/div\u003e\n\n## About this Repo\n\nThis project is **now open sourced and completely free**. Hope you enjoy it!\n\nIf you like it, please consider [sponsor](https://github.com/xororz/local-dream?tab=readme-ov-file#-support-this-project) this project.\n\n\u003e [!NOTE]\n\u003e Currently focus on SD1.5 and SDXL models. SD2.1 models are no longer maintained due to poor quality and not popular. SDXL models are only available for Snapdragon 8 Gen 3, Snapdragon 8 Elite and Snapdragon 8 Elite Gen 5/ 8 Gen 5.\n\u003e\n\u003e Most users don't get how to properly use highres mode for SD1.5. Please check [here](#npu-high-resolution-support).\n\u003e\n\u003e Now you can import your own NPU models converted using our easy-to-follow [NPU Model Conversion Guide](https://github.com/xororz/local-dream/tree/master/convert). And you can also download some pre-converted models from [xororz/sd-qnn](https://huggingface.co/xororz/sd-qnn/tree/main) or [xororz/sdxl-qnn](https://huggingface.co/xororz/sdxl-qnn/tree/main) or [Mr-J-369](https://huggingface.co/Mr-J-369). For SD1.5 models, download `_min` if you are using non-flagship chips. Download `_8gen1` if you are using 8gen1. Download `_8gen2` if you are using 8gen2/3/4/5. We recommend checking the instructions on the original model page to set up prompts and parameters.\n\u003e\n\u003e You can join our [telegram group](https://t.me/local_dream) for discussion or help with testing.\n\n## 🚀 Quick Start\n\n1. **Download**: Get the APK from [Releases](https://github.com/xororz/local-dream/releases) or [Google Play](https://play.google.com/store/apps/details?id=io.github.xororz.localdream)(NSFW filtered)\n2. **Install**: Install the APK on your Android device\n3. **Select Models**: Open the app and download the model(s) you want to use\n\n## ✨ Features\n\n- 🎨 **txt2img** - Generate images from text descriptions\n- 🖼️ **img2img** - Transform existing images\n- 🎭 **inpaint** - Redraw selected areas of images\n- **custom models** - Import your own SD1.5 models for CPU (in app), SD1.5 and SDXL for NPU (follow [conversion guide](https://github.com/xororz/local-dream/tree/master/convert)). You can get some pre-converted models from [xororz/sd-qnn](https://huggingface.co/xororz/sd-qnn/tree/main) or [xororz/sdxl-qnn](https://huggingface.co/xororz/sdxl-qnn/tree/main) or [Mr-J-369](https://huggingface.co/Mr-J-369)\n- **lora support** - Support adding LoRA weights to custom CPU models when importing.\n- **prompt weights** - Emphasize certain words in prompts. E.g., `(masterpiece:1.5)`. Same format as [Automatic1111](https://github.com/AUTOMATIC1111/stable-diffusion-webui)\n- **embeddings** - Support for custom embeddings like [EasyNegative](https://civitai.com/models/7808/easynegative). SafeTensor format is required. Convert `pt` to `safetensors` using [this](https://chino.icu/local-dream/pt2sf.py)\n- **upscalers** - 4x upscaling with [realesrgan_x4plus_anime_6b](https://github.com/xinntao/Real-ESRGAN/) and [4x-UltraSharpV2_Lite](https://huggingface.co/Kim2091/UltraSharpV2)\n\n## 🔧 Build Instructions\n\n\u003e **Note**: Building on Linux/WSL is recommended. Other platforms are not verified.\n\n### Prerequisites\n\nThe following tools are required for building:\n\n- **Rust** - Install [rustup](https://rustup.rs/), then run:\n  ```bash\n  # rustup default stable\n  rustup default 1.84.0 # Please use 1.84.0 for compatibility. Newer versions may cause build failures.\n  rustup target add aarch64-linux-android\n  ```\n- **Ninja** - Build system\n- **CMake** - Build configuration\n\n### 1. Clone Repository\n\n```bash\ngit clone --recursive https://github.com/xororz/local-dream.git\n```\n\n### 2. Prepare SDKs\n\n1. **Download QNN SDK**: Get [QNN_SDK_2.39](https://apigwx-aws.qualcomm.com/qsc/public/v1/api/download/software/sdks/Qualcomm_AI_Runtime_Community/All/2.39.0.250926/v2.39.0.250926.zip) and extract\n2. **Download Android NDK**: Get [Android NDK](https://developer.android.com/ndk/downloads) and extract\n3. **Configure paths**:\n   - Update `QNN_SDK_ROOT` in `app/src/main/cpp/CMakeLists.txt`\n   - Update `ANDROID_NDK_ROOT` in `app/src/main/cpp/CMakePresets.json`\n\n### 3. Build Libraries\n\n**Linux**\n\n```bash\ncd app/src/main/cpp/\nbash ./build.sh\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eWindows\u003c/strong\u003e\u003c/summary\u003e\n\n```powershell\n# Install dependencies if needed:\n# winget install Kitware.CMake\n# winget install Ninja-build.Ninja\n# winget install Rustlang.Rustup\n\ncd app\\src\\main\\cpp\\\n\n# Convert patch file (install dos2unix if needed: winget install -e --id waterlan.dos2unix)\ndos2unix SampleApp.patch\n.\\build.bat\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003emacOS\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\n# Install dependencies with Homebrew:\n# brew install cmake rust ninja\n\n# Fix CMake version compatibility\nsed -i '' '2s/$/ -DCMAKE_POLICY_VERSION_MINIMUM=3.5/' build.sh\nbash ./build.sh\n```\n\n\u003c/details\u003e\n\n### 4. Build APK\n\nOpen this project in Android Studio and navigate to:\n**Build → Generate App Bundles or APKs → Generate APKs**\n\n## Technical Implementation\n\n### NPU Acceleration\n\n- **SDK**: Qualcomm QNN SDK leveraging Hexagon NPU\n- **Quantization**: W8A16 static quantization for optimal performance\n- **Resolution**: For SD1.5, fixed 512×512 base model shape, more shapes available using patches. For SDXL, fixed 1024x1024 model shape\n- **Performance**: Extremely fast inference speed\n\n### CPU/GPU Inference\n\n- **Framework**: Powered by MNN framework\n- **Quantization**: W8 dynamic quantization\n- **Resolution**: Flexible sizes (128×128, 256×256, 384×384, 512×512)\n- **Performance**: Moderate speed with high compatibility\n\n## NPU High Resolution Support\n\n\u003e [!IMPORTANT]\n\u003e Please note that quantized high-resolution(\u003e768x768) SD1.5 models may produce images with poor layout. We recommend first generating at 512 resolution (optionally you can upscale it), then using the high-resolution model for img2img (which is essentially Highres.fix). The suggested img2img denoise_strength is around 0.8. After that, you can get images with better layout and details.\n\n## Device Compatibility\n\n### NPU Acceleration Support\n\nSD1.5 compatible with devices featuring:\n\n- **Snapdragon 8 Gen 1/8+ Gen 1**\n- **Snapdragon 8 Gen 2**\n- **Snapdragon 8 Gen 3**\n- **Snapdragon 8 Elite**\n- **Snapdragon 8 Elite Gen 5/8 Gen 5**\n- Non-flagship chips with Hexagon V68 or above (e.g., Snapdragon 7 Gen 1, 8s Gen 3)\n\nSDXL compatible with devices featuring:\n\n- **Snapdragon 8 Gen 3**\n- **Snapdragon 8 Elite**\n- **Snapdragon 8 Elite Gen 5/8 Gen 5**\n\n\u003e **Note**: Other devices cannot download NPU models\n\n### CPU/GPU Support\n\n- **RAM Requirement**: ~2GB available memory\n- **Compatibility**: Most Android devices from recent years\n\n## Available Models\n\nThe following models are built-in and can be downloaded directly in the app:\n\n\u003cdiv align=\"center\"\u003e\n\n| Model                | Type  | CPU/GPU | NPU | Clip Skip | Source                                                                          |\n| -------------------- | ----- | :-----: | :-: | :-------: | ------------------------------------------------------------------------------- |\n| **SDXL Base 1.0**    | SDXL  |   ❌    | ✅  |     -     | [HuggingFace](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0)  |\n| **Illustrious v16**  | SDXL  |   ❌    | ✅  |     -     | [CivitAI](https://civitai.com/models/827184/wai-illustrious-sdxl)               |\n| **AnythingV5**       | SD1.5 |   ✅    | ✅  |     2     | [CivitAI](https://civitai.com/models/9409?modelVersionId=30163)                 |\n| **ChilloutMix**      | SD1.5 |   ✅    | ✅  |     1     | [CivitAI](https://civitai.com/models/6424/chilloutmix?modelVersionId=11732)     |\n| **Absolute Reality** | SD1.5 |   ✅    | ✅  |     2     | [CivitAI](https://civitai.com/models/81458?modelVersionId=132760)               |\n| **QteaMix**          | SD1.5 |   ✅    | ✅  |     2     | [CivitAI](https://civitai.com/models/50696/qteamix-q?modelVersionId=94654)      |\n| **CuteYukiMix**      | SD1.5 |   ✅    | ✅  |     2     | [CivitAI](https://civitai.com/models/28169?modelVersionId=265102)               |\n\n\u003c/div\u003e\n\n## 🎲 Seed Settings\n\nCustom seed support for reproducible image generation:\n\n- **CPU Mode**: Seeds guarantee identical results across different devices with same parameters\n- **GPU Mode**: Results may differ from CPU mode and can vary between different devices\n- **NPU Mode**: Seeds ensure consistent results only on devices with identical chipsets\n\n## Credits \u0026 Acknowledgments\n\n### C++ Libraries\n\n- **[Qualcomm QNN SDK](https://www.qualcomm.com/developer/software/neural-processing-sdk-for-ai)** - NPU model execution\n- **[alibaba/MNN](https://github.com/alibaba/MNN/)** - CPU model execution\n- **[xtensor-stack](https://github.com/xtensor-stack)** - Tensor operations \u0026 scheduling\n- **[mlc-ai/tokenizers-cpp](https://github.com/mlc-ai/tokenizers-cpp)** - Text tokenization\n- **[yhirose/cpp-httplib](https://github.com/yhirose/cpp-httplib)** - HTTP server\n- **[nothings/stb](https://github.com/nothings/stb)** - Image processing\n- **[facebook/zstd](https://github.com/facebook/zstd)** - Model compression\n- **[nlohmann/json](https://github.com/nlohmann/json)** - JSON processing\n\n### Android Libraries\n\n- **[square/okhttp](https://github.com/square/okhttp)** - HTTP client\n- **[coil-kt/coil](https://github.com/coil-kt/coil)** - Image loading \u0026 processing\n- **[MoyuruAizawa/Cropify](https://github.com/MoyuruAizawa/Cropify)** - Image cropping\n- **AOSP, Material Design, Jetpack Compose** - UI framework\n\n### Models\n\n- **[CompVis/stable-diffusion](https://github.com/CompVis/stable-diffusion)** and all other model creators\n- **[xinntao/Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN)** - Image upscaling\n- **[Kim2091/UltraSharpV2](https://huggingface.co/Kim2091/UltraSharpV2)** - Image upscaling\n- **[bhky/opennsfw2](https://github.com/bhky/opennsfw2)** - NSFW content filtering\n\n---\n\n## 💖 Support This Project\n\nIf you find Local Dream useful, please consider supporting its development:\n\n### What Your Support Helps With:\n\n- **Additional Models** - More AI model integrations\n- **New Features** - Enhanced functionality and capabilities\n- **Bug Fixes** - Continuous improvement and maintenance\n\n\u003ca href=\"https://ko-fi.com/xororz\"\u003e\n    \u003cimg height=\"36\" style=\"border:0px;height:36px;\" src=\"https://storage.ko-fi.com/cdn/kofi2.png?v=3\" border=\"0\" alt=\"Buy Me a Coffee at ko-fi.com\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://afdian.com/a/xororz\"\u003e\n    \u003cimg height=\"36\" style=\"border-radius:12px;height:36px;\" src=\"https://pic1.afdiancdn.com/static/img/welcome/button-sponsorme.jpg\" alt=\"在爱发电支持我\" /\u003e\n\u003c/a\u003e\n\nYour sponsorship helps maintain and improve Local Dream for everyone!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxororz%2Flocal-dream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxororz%2Flocal-dream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxororz%2Flocal-dream/lists"}