How To Install and Run FastSD CPU on Android + Temux – Step By Step Guide

FastSD CPU allows us to run fast stable diffusion on the CPU. In this step-by-step guide, we will discuss how we can install and run FastSD CPU on Android.

Prerequisites

  • Android Phone with minimum 6/8GB RAM
  • Android 13 or higher

Install Termux

First, we need to download and install F-droid. F-Droid is an installable catalog of Free and Open Source Software (FOSS) applications for the Android platform. We can install Termux using F-droid.(Even though Termux is available at the Google Play store it has some package issues so we are using F-droid-based installation.

  • Download and install F-droid APK from here

After installation Open the F-droid app and search “Termux” and download and install “Termux Terminal emulator with packages” as shown below.

Fdroid Termux search screen

Install PRoot

PRoot is a tool that allows you to run programs with different file system views, allowing programs to have a different view of the filesystem than the host system, essentially creating a fake root filesystem for the program.

Open the Termux and execute the following commands one by one.

pkg update
pkg upgrade -y
termux-setup-storage
pkg install wget -y
pkg install git -y
pkg install proot -y

Install Ubuntu

Run the following commands to install Ubuntu.

pkg install proot-distro
proot-distro install ubuntu

Install Basic Tools

Login into the Ubuntu using the below command :

proot-distro login ubuntu

Run the following commands after the login:

apt update && apt upgrade -y && apt-get install curl git gcc make build-essential python3 python3-dev python3-distutils python3-pip python3-venv python-is-python3 -y
apt-get install libgl1 libglib2.0-0 libsm6 libxrender1 libxext6 -y

Install FastSD CPU

Clone the FastSD CPU repository. (We used commit 65a6ced269f2542e58c189fca2842bdbb616f74b on the master branch)

git clone https://github.com/rupeshs/fastsdcpu

Enter into the FastSD CPU directory

cd fastsdcpu
chmod +x install.sh

Run the following command to install :

./install.sh --disable-gui

Wait for the installation to finish. Now start FastSD CPU using the below command :

./start-webui.sh

Open the URL http://127.0.0.1:7860/ in the browser. (In the Generation Settings tab enable tiny autoencoder for SD to speed up the image generation)

Test environment

We tested FastSD CPU on the following environment:

  • Google Pixel 7 Pro
  • Android 14
  • Python 3.11.6
  • Termux + Ubuntu 23.0