Termux-Diffusion
Official Z-Image Turbo (6.0B DiT) & Pure Native On-Device Diffusion Acceleration for Android Termux
Install the official package directly into your runtime:
pip install termux-diffusion && termux-diffusion install
# or:
npm install termux-diffusion && npx termux-diffusion install
The Engineering Challenge
Executing modern 6.0B Diffusion Transformers on mobile hardware requires cloud dependencies or leads to immediate Out-of-Memory (LMK) aborts due to VRAM exhaustion.
The Architectural Breakthrough
Executes 6.0B DiT (Z-Image Turbo) and quantized Stable Diffusion models with Tri-Engine asymmetric offloading, layer streaming, Vulkan compute shaders, and ARMv8.2-A DotProd/FP16 NEON SIMD.
Key Capabilities & Built-in Hardening
Official Z-Image Turbo (6.0B DiT)
Native mobile execution of 6.0B Diffusion Transformer via Tri-Engine pipeline (Qwen3-4B LLM text encoder + DiT backbone + 10MB fast VAE).
Dynamic Layer Streaming & Zero-OOM
Streams DiT layers into Vulkan VRAM sequentially, maintaining a strict 1.0 GB VRAM footprint to prevent mobile LMK kills.
Dual-Engine Vulkan GPU & CPU Baseline
Bypasses PRoot with precompiled Khronos Vulkan 1.1+ compute kernels and OpenMP NEON SIMD vector runtime.
Android MediaStore Auto-Indexing
Automatically synchronizes generated images into Pictures/TermuxDiffusion and registers with Android MediaStore.
Supported Compute Kernels & Operations
| Subsystem Category | Operations & Kernels | Status |
|---|---|---|
| Diffusion Transformer (DiT) | Z-Image Turbo (6.0B DiT), Qwen3-4B-Instruct LLM Text Encoder, TAESD FLUX.1 VAE | Production |
| Diffusion UNet Engines | SD 1.5, SDXS Distilled, SD Turbo, DreamShaper 8 (LCM 6-step), Realistic Vision, GGML Quantized Weights | Production |
| Compute Acceleration | Khronos Vulkan 1.1+ GPU Shaders, Dynamic Layer Streaming, ARM64 DotProd/FP16 NEON SIMD, OpenMP | Production |
| Media Integration | PNG/WebP Export, Android MediaStore Intent Broadcast | Production |
Canonical Usage Example
import termux_diffusion as td
# Generate image using official on-device acceleration
image_path = td.generate(
prompt="A cinematic photo of a neon cybernetic tiger walking in Seoul street at night",
model="anime",
steps=6,
device="vulkan"
)
print(f"Generated and saved to Gallery: {image_path}")