Run Stable Diffusion WebUI on Scaleway GPU in 5 min tutorial (Ubuntu)

25 novembre 2022 0 Par Aschen

It’s almost impossible to work in the tech industry and not having heard of the new progress of IA generated image.

You want to play with Stable Diffusion and generate your own artwork but you don’t have an expensive graphic card? Don’t worry, just follow this tutorial 😁

In this article, I will show you how to run Stable Diffusion with Stable Diffusion UI on the cheap but efficient Scaleway GPU.

Run a GPU instance

Connect to your Scaleway Console and select PARIS-2 zone then choose the GPU-3070-S GPU.

Prepare your server

First, you need to install Python 3.10 and LibGL (See original instructions for Python3.10 here)

add-apt-repository ppa:deadsnakes/ppa
apt update 
apt install python3.10 libgl1
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2

Then create an user that we will use for the rest of this tutorial

adduser aschen
# follow instruction and give a simple password
adduser aschen sudo

Finally, connect as the user

su aschen
cd

Install Stable Diffusion UI

Clone the repository

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

Then you need to initialize a virtual environment

python3 -m venv stable-diffusion-webui/venv/ --without-pip

Because of a bug in Ubuntu, you need to install pip inside the virtual environment

source stable-diffusion-webui/venv/bin/activate
curl -sS https://bootstrap.pypa.io/get-pip.py | python3

Run the WebUI

First, modify the stable-diffusion-webui/webui-user.sh file to disable Torch Cuda test, replace line 8 by this

# Open file with: nano stable-diffusion-webui/webui-user.sh

export COMMANDLINE_ARGS="--skip-torch-cuda-test"

Now you need to download the pre-trained model

wget -O stable-diffusion-webui/models/Stable-diffusion/model.ckpt "https://drive.yerf.org/wl/?id=EBfTrmcCCUAGaQBXVIj5lJmEhjoP1tgl&mode=grid&download=1"

You can finally run the web interface 😀

cd stable-diffusion-webui/
bash webui.sh --share --precision full --no-half