Image generated by InvokeAI

Machine Learning in Linux: InvokeAI – a Stable Diffusion Toolkit

Deep Learning is a subset of Machine Learning that uses multi-layers artificial neural networks to deliver state-of-the-art accuracy in tasks such as object detection, speech recognition, language translation and others. Think of Machine Learning as cutting-edge, and Deep Learning as the cutting-edge of the cutting-edge.

An extremely interesting area of research relates to deep learning text-to-image models such as Stable Diffusion. These models can generate highly detailed images based on text descriptions.

InvokeAI is a Stable Diffusion toolkit. It provides a streamlined process with various new features and options to aid the image generation process. The project has spent considerable effort finetuning the installation process as well as developing a convenient web interface and an interactive command line interface.

Installation

You need a graphics card with a minimum of 4GB of VRAM and correctly installed GPU drivers (it’s possible to use the CPU only). The software works well with an Nvidia-based card (with CUDA support) or an AMD card (using the ROCm driver).

We’re testing the software with a GeForce RTX 3060 Ti graphics card (8GB of VRAM) and a fully functioning installation of CUDA, a parallel computing platform and application programming interface.

There are quite a few steps needed to install the software. If you’re never installed InvokeAI before, it’s strongly recommended to use the project’s automated installer. Let’s take you through the steps under Ubuntu 22.04.

First we want to ensure our environment has Python 3.10. Issue the commands:

$ sudo apt update
$ sudo apt install -y python3 python3-pip python3-venv
$ sudo update-alternatives --install /usr/local/bin/python python /usr/bin/python3.10 3

A few additional Ubuntu packages are needed:

$ sudo apt update && sudo apt install -y libglib2.0-0 libgl1-mesa-glx

We’re now ready to download the installer. We’ll use wget to download it:

$ wget https://github.com/invoke-ai/InvokeAI/files/10836362/InvokeAI-installer-v2.3.1.post2.zip

Extract that zip to a convenient location and change into the newly created InvokeAI-Installer folder. In that folder there’s a readme.txt file and an install.sh script.

Run the script:

$ ./install.sh

The script installs the software to ~/invokeai but you’re offered to choose a different location. You are prompted to select your graphics card (that’s either NVIDIA GPU, AMD GPU, or no compatible GPU / use CPU only).

The script then proceeds to configure the InvokeAI application directory, download the Stable Diffusion weight files and other large models, and create initial configuration files.

You’re then prompted to configure the startup settings.

InvokeAI - configure startup settings
Click image for full size

The next step is to install some of the starter models. The models stable-diffusion-1.5, stable-diffusion-2.1 and sd-inpainting-1.5 are selected for you (we’ve already installed them in the image below).

InvokeAI starter models
Click image for full size

Unless you’ve got a fast internet connection, the models aren’t quick to download. Make a cup of coffee while the models are downloaded and installed.

Next page: Page 2 – In Operation and Summary

Pages in this article:
Page 1 – Introduction and Installation
Page 2 – In Operation and Summary

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Please read our FAQ before making a comment.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments