termux-diffusion 1.6.4__tar.gz → 1.6.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- termux_diffusion-1.6.6/PKG-INFO +110 -0
- termux_diffusion-1.6.6/README.md +121 -0
- termux_diffusion-1.6.6/README.pypi.md +72 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/pyproject.toml +11 -27
- termux_diffusion-1.6.6/termux_diffusion/_version.py +1 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/cli.py +1 -2
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/core.py +2 -14
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/downloader.py +2 -2
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/installer.py +102 -224
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/platform.py +56 -2
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/selftest.py +3 -13
- termux_diffusion-1.6.6/termux_diffusion.egg-info/PKG-INFO +110 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion.egg-info/SOURCES.txt +1 -0
- termux_diffusion-1.6.6/termux_diffusion.egg-info/requires.txt +3 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/tests/test_installer.py +26 -11
- termux_diffusion-1.6.4/PKG-INFO +0 -508
- termux_diffusion-1.6.4/README.md +0 -459
- termux_diffusion-1.6.4/termux_diffusion/_version.py +0 -1
- termux_diffusion-1.6.4/termux_diffusion.egg-info/PKG-INFO +0 -508
- termux_diffusion-1.6.4/termux_diffusion.egg-info/requires.txt +0 -2
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/LICENSE +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/setup.cfg +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/setup.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/__init__.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/__main__.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/adapter.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/control/__init__.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/control/component.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/control/status.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/data/bootstrap-manifest.json +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/data/release-public-keys.json +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/data/validated-vulkan-profiles.json +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/exceptions.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/hardware.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/hub.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/locking.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/manifest.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/npu.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion/py.typed +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion.egg-info/dependency_links.txt +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion.egg-info/entry_points.txt +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/termux_diffusion.egg-info/top_level.txt +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/tests/test_core.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/tests/test_hardware.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/tests/test_hub.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/tests/test_npu.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/tests/test_platform.py +0 -0
- {termux_diffusion-1.6.4 → termux_diffusion-1.6.6}/tests/test_presets.py +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: termux-diffusion
|
|
3
|
+
Version: 1.6.6
|
|
4
|
+
Summary: Pure CPU On-Device Stable Diffusion Runtime for Android Termux (ARM64 Bionic NEON SIMD)
|
|
5
|
+
Home-page: https://github.com/uno-km/termux-diffusion
|
|
6
|
+
Author: uno-km (AMEVA Foundation)
|
|
7
|
+
Author-email: "uno-km (AMEVA Foundation)" <hosequelbo@gmail.com>
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Project-URL: Homepage, https://github.com/uno-km/termux-diffusion
|
|
10
|
+
Project-URL: Documentation, https://uno-km.github.io/termux-diffusion/
|
|
11
|
+
Project-URL: npm Package, https://www.npmjs.com/package/termux-diffusion
|
|
12
|
+
Project-URL: Bug Tracker, https://github.com/uno-km/termux-diffusion/issues
|
|
13
|
+
Project-URL: Source, https://github.com/uno-km/termux-diffusion
|
|
14
|
+
Keywords: stable-diffusion,diffusion,termux,android,samsung-galaxy,edge-ai,on-device-ai,image-generation,text-to-image,gguf,arm64,aarch64,neon,simd,bionic-libc,vae-tiling,galaxy-s25,galaxy-s21
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Operating System :: Android
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
27
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Provides-Extra: gpu
|
|
32
|
+
Requires-Dist: ameva-runtime>=2.0.0; extra == "gpu"
|
|
33
|
+
Dynamic: author
|
|
34
|
+
Dynamic: classifier
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
Dynamic: requires-python
|
|
38
|
+
|
|
39
|
+
# Termux-Diffusion (Python)
|
|
40
|
+
|
|
41
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
42
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
43
|
+
[](https://github.com/uno-km/termux-diffusion)
|
|
44
|
+
|
|
45
|
+
> **Pure CPU Native On-Device Stable Diffusion Runtime for Android Termux & Samsung Galaxy.**
|
|
46
|
+
> *Zero PRoot. Zero Virtualization. 100% Native ARM64 Bionic libc & NEON SIMD Vector Acceleration.*
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Installation & Native Engine Provisioning
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# 1. Install Python package from PyPI
|
|
54
|
+
pip install termux-diffusion
|
|
55
|
+
|
|
56
|
+
# 2. Provision prebuilt Pure CPU native engine & OpenMP runtime
|
|
57
|
+
termux-diffusion install
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Quickstart (Python SDK)
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import termux_diffusion as td
|
|
66
|
+
|
|
67
|
+
# Generate image using pure CPU with LCM anime preset
|
|
68
|
+
image_path = td.generate(
|
|
69
|
+
prompt="cute polar bear in snow, high quality illustration",
|
|
70
|
+
model="anime",
|
|
71
|
+
steps=6,
|
|
72
|
+
device="cpu",
|
|
73
|
+
output_path="polar_bear.png"
|
|
74
|
+
)
|
|
75
|
+
print(f"Generated and saved to Android Gallery: {image_path}")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## CLI Usage
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
termux-diffusion generate "cute dolphin, vibrant ocean" -m anime --cpu -o dolphin.png
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Key Capabilities
|
|
87
|
+
|
|
88
|
+
* **ARMv8.2-A DotProd & FP16 NEON SIMD**: Native matrix acceleration compiled directly against Android Bionic libc.
|
|
89
|
+
* **Built-in VAE Tiling**: Reduces peak RAM consumption by ~70% during latent-to-pixel decoding to prevent Out-Of-Memory (OOM) aborts.
|
|
90
|
+
* **Android MediaStore Auto-Indexing**: Automatically synchronizes generated images into `Pictures/TermuxDiffusion` and the native Samsung Gallery.
|
|
91
|
+
* **Fail-Fast Protection**: Blocks unintended on-device compilation cycles to protect mobile devices from severe thermal throttling.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Hardware Benchmarks (Physical Android Devices)
|
|
96
|
+
|
|
97
|
+
| Device | AP / Architecture | Wall Time | Sampling Time | Peak RAM |
|
|
98
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
99
|
+
| **Galaxy S25** | Snapdragon 8 Elite | **15m 52s (951s)** | 11m 37s (697s) | ~2.5 GB |
|
|
100
|
+
| **Galaxy S21** | Exynos 2100 | **53m 45s (3221s)** | 7m 47s (467s) | ~2.4 GB |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Documentation & Repository
|
|
105
|
+
- [Official Architecture & API Reference](https://uno-km.vercel.app/lib/diffusion/)
|
|
106
|
+
- [GitHub Repository](https://github.com/uno-km/termux-diffusion)
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
Apache-2.0 License. Copyright (c) 2026 Eunho Kim (@uno-km).
|
|
110
|
+
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Termux-Diffusion
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
4
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
5
|
+
[](https://www.npmjs.com/package/termux-diffusion)
|
|
6
|
+
[](https://www.npmjs.com/package/termux-diffusion)
|
|
7
|
+
[](https://github.com/uno-km/termux-diffusion)
|
|
8
|
+
|
|
9
|
+
> **Pure CPU Native On-Device Stable Diffusion Runtime for Android Termux & Samsung Galaxy.**
|
|
10
|
+
> *Zero PRoot. Zero Virtualization. 100% Native ARM64 Bionic libc & NEON SIMD Vector Acceleration.*
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. Architecture & Key Engineering Features
|
|
15
|
+
|
|
16
|
+
`termux-diffusion` is a standalone on-device image synthesis engine engineered specifically for Android smartphones running Termux. It operates directly against Android's native Bionic libc ABI with zero virtualization layers.
|
|
17
|
+
|
|
18
|
+
* **Pure CPU Native Bionic Execution**: Bypasses heavy PRoot Linux containers and virtualization overhead, binding directly to native ARM64 CPU instructions.
|
|
19
|
+
* **One-Touch Prebuilt Provisioning**: Provisions precompiled native binaries (`sd-cli-cpu`) and the OpenMP runtime (`libomp.so`) in seconds via a single command, completely eliminating 20-minute on-device C++ compilation cycles.
|
|
20
|
+
* **ARMv8.2-A DotProd & FP16 NEON SIMD**: Employs optimized vector matrix multiplication kernels tailored for modern mobile microarchitectures (Cortex-X, Cortex-A78, Oryon).
|
|
21
|
+
* **Built-in VAE Tiling**: Eliminates the ~1.2 GB memory spike during latent-to-pixel decoding, reducing peak RAM consumption by ~70% and preventing Android low-memory killer (LMK) aborts.
|
|
22
|
+
* **Automated Android MediaStore Indexing**: Synchronizes synthesized images directly to `Pictures/TermuxDiffusion` and broadcasts media scan intents for real-time visibility in the Samsung Gallery app.
|
|
23
|
+
* **Fail-Fast Thermal Protection**: On-device compilation on Termux is blocked by default without explicit opt-in (`TERMUX_DIFFUSION_ALLOW_SOURCE_BUILD=1`), guarding the device against excessive thermal throttling.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 2. Installation & One-Touch Native Provisioning
|
|
28
|
+
|
|
29
|
+
### 2.1 System Prerequisites (Termux)
|
|
30
|
+
In the Termux terminal, install the core runtime dependencies:
|
|
31
|
+
```bash
|
|
32
|
+
pkg update && pkg install -y python nodejs clang termux-api
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2.2 Package Installation
|
|
36
|
+
|
|
37
|
+
* **Python SDK (PyPI)**:
|
|
38
|
+
```bash
|
|
39
|
+
pip install termux-diffusion
|
|
40
|
+
termux-diffusion install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
* **Node.js SDK & CLI (NPM)**:
|
|
44
|
+
```bash
|
|
45
|
+
npm install -g termux-diffusion
|
|
46
|
+
npx termux-diffusion install
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> The `install` command provisions the standalone CPU native engine (`sd-cli-cpu`) and companion OpenMP runtime (`libomp.so`) directly into `~/.cache/termux-diffusion/bin`.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 3. Quickstart & Usage
|
|
54
|
+
|
|
55
|
+
### 3.1 CLI Interface
|
|
56
|
+
```bash
|
|
57
|
+
# Generate image using pure CPU with default LCM anime preset (6 steps)
|
|
58
|
+
termux-diffusion generate "cute polar bear, high quality illustration" -m anime --cpu -o polar_bear.png
|
|
59
|
+
|
|
60
|
+
# Custom dimensions, steps, and threads
|
|
61
|
+
termux-diffusion generate "cute dolphin, vibrant ocean, 8k resolution" -W 512 -H 512 --steps 6 -t 4 -o dolphin.png
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3.2 Python SDK
|
|
65
|
+
```python
|
|
66
|
+
import termux_diffusion as td
|
|
67
|
+
|
|
68
|
+
# Synthesize image via Pure CPU Native Engine
|
|
69
|
+
image_path = td.generate(
|
|
70
|
+
prompt="cute polar bear in snow, high quality illustration",
|
|
71
|
+
model="anime",
|
|
72
|
+
steps=6,
|
|
73
|
+
device="cpu",
|
|
74
|
+
output_path="polar_bear.png"
|
|
75
|
+
)
|
|
76
|
+
print(f"Generated artifact: {image_path}")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 3.3 Node.js / TypeScript SDK
|
|
80
|
+
```typescript
|
|
81
|
+
import { generate } from "termux-diffusion";
|
|
82
|
+
|
|
83
|
+
async function main() {
|
|
84
|
+
const result = await generate({
|
|
85
|
+
prompt: "cute dolphin leaping through waves, high quality illustration",
|
|
86
|
+
model: "anime",
|
|
87
|
+
steps: 6,
|
|
88
|
+
device: "cpu",
|
|
89
|
+
outputPath: "dolphin.png"
|
|
90
|
+
});
|
|
91
|
+
console.log("Image synthesized:", result.outputPath);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
main();
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 4. Verified Hardware Benchmarks (Ground Truth)
|
|
100
|
+
|
|
101
|
+
All benchmarks measured on physical Android hardware using pure CPU execution (`sd-cli-cpu`, 4 threads, NEON SIMD) with the `anime` preset (DreamShaper 8 LCM Q4_0, 512x512, 6 steps):
|
|
102
|
+
|
|
103
|
+
| Device | SoC & CPU Architecture | Total Time (Wall Time) | Sampling Time | Peak RAM (VmRSS) | Output Resolution |
|
|
104
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
105
|
+
| **Samsung Galaxy S25** | Snapdragon 8 Elite (Oryon CPU) | **15m 52s (951s)** | **11m 37s (697s)** | **~2.5 GB** | 512 × 512 PNG |
|
|
106
|
+
| **Samsung Galaxy S21** | Exynos 2100 (Cortex-X1 + A78) | **53m 45s (3221s)** | **7m 47s (467s)** | **~2.4 GB** | 512 × 512 PNG |
|
|
107
|
+
|
|
108
|
+
*Both devices completed end-to-end inference and synchronized outputs to the Android MediaStore without memory leaks or crash events.*
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 5. Official Ecosystem Documentation
|
|
113
|
+
- [Official Architecture & API Reference](https://uno-km.vercel.app/lib/diffusion/)
|
|
114
|
+
- [Ecosystem Metrics & Registry Stats](https://uno-km.vercel.app/foundation/metrics)
|
|
115
|
+
- [AMEVA Open-Source Foundation Portal](https://uno-km.vercel.app/foundation/index.html)
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 6. License
|
|
120
|
+
Licensed under the Apache-2.0 License. Copyright (c) 2026 Eunho Kim ([@uno-km](https://github.com/uno-km)).
|
|
121
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Termux-Diffusion (Python)
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
4
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
5
|
+
[](https://github.com/uno-km/termux-diffusion)
|
|
6
|
+
|
|
7
|
+
> **Pure CPU Native On-Device Stable Diffusion Runtime for Android Termux & Samsung Galaxy.**
|
|
8
|
+
> *Zero PRoot. Zero Virtualization. 100% Native ARM64 Bionic libc & NEON SIMD Vector Acceleration.*
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Installation & Native Engine Provisioning
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# 1. Install Python package from PyPI
|
|
16
|
+
pip install termux-diffusion
|
|
17
|
+
|
|
18
|
+
# 2. Provision prebuilt Pure CPU native engine & OpenMP runtime
|
|
19
|
+
termux-diffusion install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Quickstart (Python SDK)
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
import termux_diffusion as td
|
|
28
|
+
|
|
29
|
+
# Generate image using pure CPU with LCM anime preset
|
|
30
|
+
image_path = td.generate(
|
|
31
|
+
prompt="cute polar bear in snow, high quality illustration",
|
|
32
|
+
model="anime",
|
|
33
|
+
steps=6,
|
|
34
|
+
device="cpu",
|
|
35
|
+
output_path="polar_bear.png"
|
|
36
|
+
)
|
|
37
|
+
print(f"Generated and saved to Android Gallery: {image_path}")
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## CLI Usage
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
termux-diffusion generate "cute dolphin, vibrant ocean" -m anime --cpu -o dolphin.png
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Key Capabilities
|
|
49
|
+
|
|
50
|
+
* **ARMv8.2-A DotProd & FP16 NEON SIMD**: Native matrix acceleration compiled directly against Android Bionic libc.
|
|
51
|
+
* **Built-in VAE Tiling**: Reduces peak RAM consumption by ~70% during latent-to-pixel decoding to prevent Out-Of-Memory (OOM) aborts.
|
|
52
|
+
* **Android MediaStore Auto-Indexing**: Automatically synchronizes generated images into `Pictures/TermuxDiffusion` and the native Samsung Gallery.
|
|
53
|
+
* **Fail-Fast Protection**: Blocks unintended on-device compilation cycles to protect mobile devices from severe thermal throttling.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Hardware Benchmarks (Physical Android Devices)
|
|
58
|
+
|
|
59
|
+
| Device | AP / Architecture | Wall Time | Sampling Time | Peak RAM |
|
|
60
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
61
|
+
| **Galaxy S25** | Snapdragon 8 Elite | **15m 52s (951s)** | 11m 37s (697s) | ~2.5 GB |
|
|
62
|
+
| **Galaxy S21** | Exynos 2100 | **53m 45s (3221s)** | 7m 47s (467s) | ~2.4 GB |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Documentation & Repository
|
|
67
|
+
- [Official Architecture & API Reference](https://uno-km.vercel.app/lib/diffusion/)
|
|
68
|
+
- [GitHub Repository](https://github.com/uno-km/termux-diffusion)
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
Apache-2.0 License. Copyright (c) 2026 Eunho Kim (@uno-km).
|
|
72
|
+
|
|
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "termux-diffusion"
|
|
7
|
-
version = "1.6.
|
|
8
|
-
description = "On-
|
|
9
|
-
readme = "README.md"
|
|
7
|
+
version = "1.6.6"
|
|
8
|
+
description = "Pure CPU On-Device Stable Diffusion Runtime for Android Termux (ARM64 Bionic NEON SIMD)"
|
|
9
|
+
readme = "README.pypi.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
11
|
-
license = { text = "
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
12
|
authors = [
|
|
13
13
|
{ name = "uno-km (AMEVA Foundation)", email = "hosequelbo@gmail.com" }
|
|
14
14
|
]
|
|
@@ -22,37 +22,21 @@ keywords = [
|
|
|
22
22
|
"on-device-ai",
|
|
23
23
|
"image-generation",
|
|
24
24
|
"text-to-image",
|
|
25
|
-
"txt2img",
|
|
26
|
-
"img2img",
|
|
27
25
|
"gguf",
|
|
28
26
|
"arm64",
|
|
29
27
|
"aarch64",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"spirv",
|
|
33
|
-
"adreno",
|
|
34
|
-
"mali",
|
|
35
|
-
"snapdragon",
|
|
36
|
-
"exynos",
|
|
28
|
+
"neon",
|
|
29
|
+
"simd",
|
|
37
30
|
"bionic-libc",
|
|
38
|
-
"taesd",
|
|
39
31
|
"vae-tiling",
|
|
40
|
-
"lora",
|
|
41
|
-
"controlnet",
|
|
42
|
-
"sdxs",
|
|
43
|
-
"sd-turbo",
|
|
44
|
-
"dreamshaper",
|
|
45
|
-
"mobile-inference",
|
|
46
|
-
"camera-roll",
|
|
47
32
|
"galaxy-s25",
|
|
48
|
-
"galaxy-
|
|
49
|
-
"private-ai"
|
|
33
|
+
"galaxy-s21"
|
|
50
34
|
]
|
|
51
35
|
dynamic = ["classifiers"]
|
|
52
|
-
dependencies = [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
]
|
|
36
|
+
dependencies = []
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
gpu = ["ameva-runtime>=2.0.0"]
|
|
56
40
|
|
|
57
41
|
[project.urls]
|
|
58
42
|
Homepage = "https://github.com/uno-km/termux-diffusion"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.6.6"
|
|
@@ -69,7 +69,6 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
69
69
|
|
|
70
70
|
# install command
|
|
71
71
|
inst_parser = subparsers.add_parser("install", help="Provision native Bionic CPU engine (sd-cli-cpu & libomp.so)")
|
|
72
|
-
inst_parser.add_argument("-b", "--backend", type=str, default="cpu", choices=["cpu", "vulkan", "opencl", "auto"], help="Target compute backend (default: cpu)")
|
|
73
72
|
inst_parser.add_argument("-f", "--force", action="store_true", default=False, help="Force re-installation")
|
|
74
73
|
|
|
75
74
|
# doctor command
|
|
@@ -176,7 +175,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
176
175
|
return ExitCode.BUILD_ERROR
|
|
177
176
|
|
|
178
177
|
elif args.command == "install":
|
|
179
|
-
provision_engine(force=args.force
|
|
178
|
+
provision_engine(force=args.force)
|
|
180
179
|
return 0
|
|
181
180
|
|
|
182
181
|
elif args.command == "doctor":
|
|
@@ -485,22 +485,10 @@ def generate(
|
|
|
485
485
|
cmd.extend(["--taesd", str(effective_taesd_path)])
|
|
486
486
|
|
|
487
487
|
# 5.1 Configure Environment with companion library search paths (Termux native isolation)
|
|
488
|
-
|
|
488
|
+
from .platform import get_clean_execution_env
|
|
489
|
+
env = get_clean_execution_env()
|
|
489
490
|
# Bypass debug CPU shadow checks on mobile Vulkan to unlock 10x throughput
|
|
490
491
|
env.setdefault("GGML_VULKAN_SKIP_CHECKS", "999999999")
|
|
491
|
-
prefix = os.environ.get("PREFIX", "/data/data/com.termux/files/usr")
|
|
492
|
-
lib_dirs = [
|
|
493
|
-
str(Path.home() / ".cache" / "termux-diffusion" / "lib"),
|
|
494
|
-
str(Path.home() / ".cache" / "termux-diffusion" / "staging" / "lib"),
|
|
495
|
-
]
|
|
496
|
-
cur_ld = env.get("LD_LIBRARY_PATH", "")
|
|
497
|
-
valid_dirs = [d for d in lib_dirs if Path(d).is_dir() and "/usr/lib" not in d]
|
|
498
|
-
if valid_dirs:
|
|
499
|
-
env["LD_LIBRARY_PATH"] = ":".join(valid_dirs + ([cur_ld] if cur_ld else []))
|
|
500
|
-
elif "LD_LIBRARY_PATH" in env:
|
|
501
|
-
# Sanitize against $PREFIX/lib to prevent Bionic symbol collision with /system/lib64/libunwindstack.so
|
|
502
|
-
cleaned_ld = ":".join(p for p in cur_ld.split(":") if p and "/usr/lib" not in p)
|
|
503
|
-
env["LD_LIBRARY_PATH"] = cleaned_ld
|
|
504
492
|
|
|
505
493
|
# 5.2 ameva-runtime DiffusionAdapter Binding (Vulkan / GPU mode)
|
|
506
494
|
if effective_device in ("vulkan", "gpu") or device_mode in ("vulkan", "gpu"):
|
|
@@ -18,9 +18,9 @@ logger = logging.getLogger("termux_diffusion.downloader")
|
|
|
18
18
|
def atomic_download_file(
|
|
19
19
|
url: str,
|
|
20
20
|
dest_path: Path,
|
|
21
|
-
expected_sha256: str,
|
|
21
|
+
expected_sha256: Optional[str] = None,
|
|
22
22
|
expected_size: Optional[int] = None,
|
|
23
|
-
timeout_sec: float =
|
|
23
|
+
timeout_sec: float = 120.0,
|
|
24
24
|
user_agent: str = "termux-diffusion-downloader/1.2.0"
|
|
25
25
|
) -> Path:
|
|
26
26
|
"""Download url to dest_path atomically using .part -> SHA256 check -> atomic rename -> rollback."""
|