termux-train
Native On-Device Deep Learning & LoRA Training Framework for Android Termux (ARM64 Bionic)
termux-train์ ๋น ํ ํฌ์ ํด๋ผ์ฐ๋ GPU ๋ ์ ์ข ์์ ํํํ๊ณ , ์ ์ธ๊ณ ๋ชจ๋ ๊ฐ๋ฐ์๊ฐ ์ค๋งํธํฐ๊ณผ ์ฃ์ง ๋จ๋ง์์ 100% ๋ฌด๋ฃ๋ก AI๋ฅผ ์ง์ ํ์ตํ๊ณ ๋ฏธ์ธ์กฐ์ (LoRA)ํ ์ ์๋๋ก ์ง์ํ๋ ์๋ฉ๋ฐ ์ฌ๋จ(AMEVA Foundation)์ ๊ณต์ ์คํ์์ค ํ๋ก์ ํธ์ ๋๋ค.
The Mobile Deep Learning Challenge
Standard PyTorch binaries fail on Android Termux due to GNU Glibc vs Android Bionic Libc mismatch, while PRoot Linux containers add 40% memory overhead and trigger Android LMK (Low Memory Killer) aborts.
The Zero-Dependency Breakthrough
termux-train runs natively on Android Termux with a pure Python DAG Autograd core, pluggable NumPy/OpenBLAS ARM NEON SIMD vectorization, RoPE Transformers, SafeTensors zero-copy, and low-rank LoRA fine-tuning.
Key Capabilities & Mobile Architecture
โก Pure Python Autograd Core
Zero C++ dependency dynamic computation graph with reverse-mode DAG autograd. Runs everywhere without compilation.
๐ฏ On-Device LoRA Adapters
Freeze 96%+ base weights and fine-tune low-rank adapters with <100KB SafeTensors footprint.
๐ง RoPE & Incremental KV Cache
Rotary Position Embedding with O(0) learnable parameters and O(1) step generation cache.
๐พ SafeTensors Zero-Copy I/O
HuggingFace-compatible binary serialization eliminating Python pickle memory bloat and LMK crashes.
๐ฆ Streaming MMap Datasets
Stream multi-gigabyte token datasets directly from disk via kernel page cache without consuming mobile RAM.
๐ Official PyPI Distribution
Install with single command pip install termux-train across Android Termux, Linux, Windows, macOS.
Canonical 10-Line Training Demo (Python)
from termux_train import Tensor, nn, optim, set_backend
# 1. Automatic C-acceleration (NumPy / OpenBLAS NEON)
set_backend("auto")
# 2. Dynamic Autograd Tensor
x = Tensor([[1.0, 2.0], [3.0, 4.0]], requires_grad=True)
w = Tensor([[2.0], [1.0]], requires_grad=True)
# 3. Forward & Backward
y = x @ w
loss = (y * y).mean()
loss.backward()
print("dL/dw:", w.grad)