Stable Diffusion

AI image generation in the cloud using NVIDIA GPUs on CUDO Compute.

Stable Diffusion is a latent text-to-image diffusion model specializing in the generation of photo-realistic images based on textual inputs. It offers users the ability to autonomously create striking visual art within seconds. This model represents a significant advancement in image generation, particularly in terms of enhanced image composition and face generation, resulting in visually impressive and highly realistic output.

With CUDO Compute you can deploy Stable Diffusion to the latest NVIDIA Ampere Architecture GPUs. Prebuilt images with NVIDIA drivers are ready to deploy.

Prerequisites

  • Create a project and add an SSH key
  • Choose a VM with an NVIDIA GPU and remember to add plenty of storage
  • Use the Ubuntu 22.04 + NVIDIA drivers + Docker image (in CLI tool type -image ubuntu-nvidia-docker)

The main reason to select a higher VRAM is if you require larger image sizes

Install easy diffusion

SSH into your VM and run the following commands

apt install zip -y
wget https://github.com/cmdr2/stable-diffusion-ui/releases/latest/download/Easy-Diffusion-Linux.zip
unzip Easy-Diffusion-Linux.zip
cd easy-diffusion

Start easy diffusion

Run easy diffusion and enable web remote access

echo -e "net:\n    listen_port: 9001\n    listen_to_network: true" > config.yaml
./start.sh

Wait a few minutes and go to http://<your-vm-ip>:9001 in your web browser

Stop easy diffusion and install xformers, then restart

Install xformers

./developer_console.sh
python -m pip install --upgrade torch==2.0.1+cu118 torchvision==0.15.2+cu118 xformers==0.0.22 --extra-index-url https://download.pytorch.org/whl/cu118

Extra models

Optionally if you want to add another model over the standard they can be found here:

An example of how to add them:

cd ~/stable-diffusion/models/stable-diffusion
wget https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.ckpt
wget https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
cd ../..
./start.sh