Guides

Stable Diffusion in 4 minutes

In this guide, we'll show you how easy it is to launch and run stable diffusion on GPUs with Brev. We've pre-configured a Brev environment for Stable Diffusion so you won't have to do any config at all!


  1. Sign up for an account

  2. It'll redirect you to an instance creation page pre-configured with the defaults you need. (We recommend sticking to the default GPU - it's the cheapest that'll work with Stable Diffusion).

  3. At the bottom, add a payment method...we give you 30 minutes free but we just need to make sure people don't abuse our systems 🙂

  4. Hit create!

Installing Brev:

Once your instance is created install Brev:

brew install brevdev/homebrew-brev/brev && brev login

Running the model:

Open your new stable-diffusion Brev environment:

brev open stable-diffusion --wait

This will open VSCode inside the Stable Diffusion repo. We've pre-loaded the sd-v1-4 checkpoint in the checkpoints folder. (--wait opens vscode only when the stable diffusion environment is fully loaded this should take about 3 minutes).

To activate your environment run:

conda activate ldm

Now, we're ready-to-go!! In your VSCode terminal, run the command below replacing "Snoop Dogg on Mars" with whichever prompt you want:

python3 scripts/txt2img.py --prompt "Snoop Dogg on Mars" --plms --ckpt checkpoints/sd-v1-4.ckpt --skip_grid --n_samples 1

And boom! Give the model a couple of minutes to load and you should see what your model generated in the outputs folder.

You can open outputs with:

code outputs/txt2img-samples/samples/00000.png
code outputs/txt2img-samples/samples/00001.png

Here are some of the outputs we got:

imgimg

If you thought that was easy, check out our other docs. We've been building the easiest way to do develop on the cloud.