AI art generation has been painting the town red – quite literally – as it continues to blur the lines between human creativity and machine-generated marvels. You may have seen the avant-garde portraits, the surreal landscapes, or perhaps that quirky meme of a cat wearing a suit (you know the one). But what if I told you that the secret sauce behind these masterpieces is something called “Stable Diffusion” and it’s taking the art world by storm, all thanks to the power of Cloud GPUs? Well, buckle up, because we’re about to learn how to run Stable Diffusion on these bad boys.

Imagine you’re an artist, and you’ve got an empty canvas in front of you. Instead of traditional brushes and paints, you’ve got your hands on a Cloud GPU – the high-octane fuel that turbocharges the creative process. This magnificent beast is all set to work its magic, but how do you tame it and put it to good use? Fear not, for we’re about to embark on a journey through the misty realm of Stable Diffusion, unraveling its enigmatic charm and exploring how it can be harnessed with the help of Cloud GPUs.

5 Simple Steps To Run Stable Diffusion On Cloud GPU

5 Simple Steps To Run Stable Diffusion On Cloud GPU
These sample images were generated with custom stable diffusion models.

Let’s start with the basics, shall we?

1) Get Your Hands on a Cloud GPU

First things first, you’ll need to set up an account with a Cloud GPU provider like Vultr, AWS, or Google Cloud. These providers offer an array of GPUs that cater to different needs and budgets. For this tutorial, we’ll be using the Nvidia GPUs offered by Vultr.

Why Vultr?

Well, it’s simple: they offer some of the most affordable Nvidia GPUs on the market, making it easier for budding artists and creative enthusiasts to dip their toes in the world of AI art generation without breaking the bank. Plus, they’ve got a reputation for being the “cool kids” on the block, and who wouldn’t want to hang out with the cool kids, right? (wink, wink)

And if that’s not enough of a reason for you, here’s $100 FREE credits for you! Yes, just signup with this link and you will get a cool $100 to kickstart your artistic journey on Vultr.

2) Choose Your Server Type, Server Location, and Operating System, and Deploy Your GPU

Hopefully, by now you have a new account with Vultr and some sweet credits to get started. Next, log in to your dashboard and click on the “Deploy New Server” button – the “+” button floating on the right-hand side of the screen.

Once clicked, you will be directed to a new “deploy server” page where you’ll be prompted to choose your server type, location, and operating system. To make things easier for you to understand, we have divided this section into six easy-to-follow steps.

Step 1. Click on the “Cloud GPU” instance that gets you access to Nvidia A100, Nvidia A40, and Nvidia A16 GPU.

Choose Your Server Type

Step 2. Now choose the Nvidia A100 GPU option. These GPUs are known for the unrivaled performance and stability they bring to the table, making them perfect for running Stable Diffusion.

Choose Nvidia A100 or Nvidia A40 GPU

Step 3. Next, pick a server location that’s closest to you for reduced latency and faster response times.

Pick a server location that’s closest to you

Step 4. Choose your preferred operating system – we recommend using Ubuntu 20.04 LTS for its ease of use and compatibility with most Stable Diffusion frameworks.

Choose Ubuntu 20.04 LTS

Step 5. As for the server size, we recommend choosing a 10 GB GPU VRAM server instance because recommended GPU requirement for stable diffusion is 8GB. An extra 2GB GPU should provide much-needed RAW performance when storing the VAEs or image enhancement models on GPU VRAM instead of RAM to gain that extra speed.

10 GB GPU VRAM server instance

Step 6. We will also recommend disabling the “auto backups” feature of Vultr to save on your server charges.

Disable auto backups

Now you will need to wait 5 minutes for your server to get installed with your chosen OS and get ready to be accessed globally.

3) Connect To Your Server With PUTTY

PUTTY is a free and open-source SSH client that allows you to connect to your Cloud GPU server securely. Download PUTTY from its official website and install it on your computer.

Once installed, open PUTTY and enter your server’s IP address (found on your Vultr dashboard) in the “Host Name (or IP address)” field. Leave the “Port” field as is (default is 22) and click on the “Open” button.

Connect To Your Server With PUTTY

A terminal window will pop up, prompting you to log in with your server’s root username and password (also found on your Vultr dashboard). Enter these credentials to gain access to your server.

A terminal window will pop up

To paste the password in the terminal, just copy the password from the Vultr dashboard and right-click on the terminal. It won’t show you the password, but it’s there. Press enter to gain access to the server.

4) Install Stable Diffusion Framework and Dependencies

With your server up and running, it’s time to install the necessary software and dependencies to run Stable Diffusion.

Here’s my optimized code to help you install Stable Difussion in literally 1-minute. Just copy and paste these codes one by one in your PUTTY terminal.

Code 1: sudo apt install git-lfs && git lfs install && sudo apt install aria2 && sudo apt install axel && git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && pip3 install fastapi && sudo ufw allow 7860 && pip install markupsafe==2.0.1

—–

Extra STEPS for Extra FUN!

Here are four more lines of code to download custom stable diffusion models for extra creative fun!

Extra Code 1: cd ~/stable-diffusion-webui/models/Stable-diffusion

Extra Code 2: aria2c -x 4 -o OldFish_2348V12.safetensors 'https://huggingface.co/jomcs/NeverEnding_Dream-Feb19-2023/resolve/main/Old%20Fish/OldFish_2348V12.safetensors' && aria2c -x 4 -o braBeautifulRealistic_brav3.safetensors 'https://huggingface.co/jomcs/NeverEnding_Dream-Feb19-2023/resolve/main/Beautiful%20Realistic%20Asians/braBeautifulRealistic_brav3.safetensors' && aria2c -x 4 -o newmarsmix_R11.safetensors 'https://huggingface.co/jomcs/NeverEnding_Dream-Feb19-2023/resolve/main/NewMarsMix/newmarsmix_R11.safetensors' && aria2c -x 4 -o V08_V08.safetensors 'https://huggingface.co/jomcs/NeverEnding_Dream-Feb19-2023/resolve/main/V80/V08_V08.safetensors' && aria2c -x 4 -o darkSushiMixMix_brighter.safetensors 'https://huggingface.co/jomcs/NeverEnding_Dream-Feb19-2023/resolve/main/Dark%20Sushi%20Mix/darkSushiMixMix_brighter.safetensors' && aria2c -x 4 -o beenyou_r4.safetensors 'https://huggingface.co/jomcs/NeverEnding_Dream-Feb19-2023/resolve/main/BeenYou/beenyou_r4.safetensors' && aria2c -x 4 -o endlessmix_v35.safetensors 'https://huggingface.co/jomcs/NeverEnding_Dream-Feb19-2023/resolve/main/EndlessMix/endlessmix_v35.safetensors'

Extra Code 3: cd ~/stable-diffusion-webui/models/VAE

Extra Code 4: aria2c -x 4 -o vae-ft-mse-840000-ema-pruned.safetensors 'https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors' && aria2c -x 4 -o kl-f8-anime2.ckpt 'https://huggingface.co/jomcs/NeverEnding_Dream-Feb19-2023/resolve/main/Beauty%202.5D/kl-f8-anime2.ckpt'

—–

Code 2: tmux new -s StableDiffusion

Code 3: cd ~/stable-diffusion-webui

Code 4: python3 launch.py --listen --xformers --enable-insecure-extension-access

5) Access Your Stable Diffusion GUI

Now it’s time to unleash the power of Stable Diffusion on your Cloud GPU! Open your favorite web browser and enter your server’s IP address followed by the port number “7860” in the address bar (e.g., http://YOUR_SERVER_IP:7860). Press Enter, and voila! You should be greeted by the Stable Diffusion Web UI, your creative playground.

Now, go ahead and experiment with different parameters and custom models (from that extra fun step) to create your very own AI-generated masterpieces. Tweak the settings, mix, and match, and let your creativity run wild.

Remember, the secret to creating great art is to keep exploring and iterating. So, unleash your inner Picasso, Van Gogh, or that cat in a suit (you know the one) and create something that leaves the world in awe.

Detailed Video Tutorial On How to Run Stable Diffusion On Cloud GPU for FREE

Understanding the Magic Behind the Code

The one-liner code provided above may seem like a spell from the Hogwarts School of Witchcraft and Wizardry, but don’t worry, we’re here to demystify it for you. Let’s break it down into smaller chunks and understand the purpose of each command:

  1. sudo apt install git-lfs: This command installs Git Large File Storage (LFS), a Git extension that enables you to work with large files in your repository without affecting performance. It’s particularly useful when dealing with AI models and datasets.
  2. git lfs install: This command initializes Git LFS in your system, making it ready to handle large files.
  3. sudo apt install aria2: Aria2 is a lightweight, multi-protocol, and multi-source command-line download utility. This command installs Aria2 on your server, which will be used later to download custom models.
  4. sudo apt install axel: Axel is another lightweight command-line download accelerator. This command installs Axel on your server as an alternative to Aria2.
  5. git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git: This command clones the Stable Diffusion Web UI repository from GitHub to your server. The repository contains the necessary code to run the Stable Diffusion process and its web interface.
  6. pip3 install fastapi: FastAPI is a modern, high-performance web framework for building APIs with Python. This command installs FastAPI on your server to enable the creation of the Stable Diffusion Web UI.
  7. sudo ufw allow 7860: UFW (Uncomplicated Firewall) is a user-friendly front-end for managing iptables firewall rules. This command allows incoming traffic on port 7860, which is required for accessing the Stable Diffusion Web UI.
  8. pip install markupsafe==2.0.1: MarkupSafe is a Python library that provides a secure way to handle untrusted input. This command installs MarkupSafe version 2.0.1 on your server, which may be required by some of the dependencies or custom models.

By running this one-liner code, you’ve essentially set up all the necessary components to run Stable Diffusion on your Cloud GPU server. The magic lies in the combination of these powerful tools and frameworks that come together to create a seamless experience for generating AI art.

Launching Stable Diffusion with Tmux and Command-line Options

Now that the stage is set, it’s time to dive into the code that brings your Stable Diffusion instance to life. Let’s take a closer look at each command and their respective roles:

  1. tmux new -s StableDiffusion: Tmux is a terminal multiplexer that allows you to manage multiple terminal sessions within a single window. This command creates a new Tmux session named “StableDiffusion”. Running Stable Diffusion within a Tmux session ensures that the process continues running even if you disconnect from the server, allowing your AI art generation to proceed uninterrupted.
  2. cd ~/stable-diffusion-webui: This command navigates to the “stable-diffusion-webui” directory, which contains the Stable Diffusion Web UI code that you cloned earlier.
  3. python3 launch.py --listen --xformers --enable-insecure-extension-access: This command runs the “launch.py” script using Python 3 with specific command-line options. Let’s break down the options:
    • --listen: This option tells the script to listen for incoming connections, allowing you to access the Stable Diffusion Web UI from your browser.
    • --xformers: This option enables the use of XFormers, a flexible and efficient transformer library for AI models. This can improve the performance of your Stable Diffusion instance.
    • --enable-insecure-extension-access: This option allows you to access the Stable Diffusion Web UI using an insecure HTTP connection. While this is not recommended for production environments due to potential security risks, it’s sufficient for personal use and experimentation.

By executing these commands, you’ve successfully launched your Stable Diffusion instance and made it accessible through a web interface. You can now harness the power of Cloud GPUs and Stable Diffusion to create stunning AI-generated art!

The Verdict

In conclusion, running Stable Diffusion on a Cloud GPU is a game-changer for AI art generation. With just a few simple steps and a dash of creativity, you can turn the digital canvas into your personal playground, crafting mind-blowing masterpieces with the power of Stable Diffusion and Cloud GPUs. So, go on, paint the town red – or blue, or green, or whatever color tickles your fancy. The world is your oyster, and the Cloud GPU is your paintbrush. Happy creating!