Sunday, November 10, 2024

Installing A.I. Text to Image FOOOCUS (runs locally)

Want to have your own Text to Image A.I.?  Let's get one up and running on Ubuntu 24.01.1 (I had it running on 22.04 too).  Let's install FOOOCUS (yes that is really three 'O's).  The Fooocus project is built entirely on the Stable Diffusion XL architecture and uses a local web front end.  Under the ADVANCED option on the web front end you can easily just tick a box to change the style and there are a lot of them.  You can also change the resolution of the generated images.  For more information about Fooocus or to find instructions to get it running on a Windows or Mac or different ways to install it on Linux check out their GIT page.

You should have a modern graphics card but you don't have to, it will run on CPU only but slowly.  According to the GIT Page you'll run about 17 times slower without a modern graphics card and you'll need a minimum of 32gb of ram.  I'm using a Nvidia RTX 3060, 32gb ram, AMD 5900X CPU and generate an image in about 30 to 45 seconds depending on settings.   

From their GIT Page here's a list of GPUs, GPU's minimum ram, minimum system ram needed and what you can expect performance wise.

Nvidia on Linux/Windows
GPU Card - GPU - System - Note
RTX 4XXX - 4GB - 8GB - fastest
RTX 3XXX - 4GB - 8GB - faster than RTX 2XXX
RTX 2XXX - 4GB - 8GB - faster than GTX 1XXX
GTX 1XXX - 8GB - 8GB - only marginally faster than CPU
GTX 9XXX - 8GB - 8GB - faster or slower than CPU

Linux AMD GPU
GPU Card - GPU - System - Note
AMD GPU - 8GB - 8GB - Via ROCm, about 1.5x slower than Nvidia RTX 3XXX

Windows/Linux/Mac
GPU Card - GPU - System - Note
CPU Only - 0GB - 32GB - About 17x slower than Nvidia RTX 3XXX

Windows AMD GPU
GPU Card - GPU - System - Note
AMD GPU - 8GB - 8GB - Via DirectML (* ROCm is on hold), about 3x slower RTX 3XXX

MAC 
GPU Card - GPU - System - Note
M1/M2 MPS - Shared - Shared - About 9x slower than Nvidia RTX 3XXX


SAMPLE IMAGE

Enough selling it, lets get it up and running.

We will be using the Linux (Using Python Venv) version.  Your Linux needs to have Python 3.10 or greater installed, and your Python can be called with the command python3 with your venv system working; 

Open a Terminal Window and enter the following command, waiting for each one to finish before executing the next one (some will take a few minutes to execute).

git clone https://github.com/lllyasviel/Fooocus.git

cd Fooocus

python3 -m venv fooocus_env

source fooocus_env/bin/activate

pip install -r requirements_versions.txt


Once that's done you launch the software with:

source fooocus_env/bin/activate

python entry_with_update.py


If you want to open a remote port;

source fooocus_env/bin/activate

python entry_with_update.py --listen

For additional information you should really read the GIT PAGE for FOOOCUS

No comments: