Skip to content

Tutorial - Stable Diffusion

Let's run AUTOMATIC1111's stable-diffusion-webui on NVIDIA Jetson to generate images from our prompts!

What you need

  1. One of the following Jetson devices:

    Jetson AGX Orin (64GB) Jetson AGX Orin (32GB) Jetson Orin NX (16GB) Jetson Orin Nano (8GB)

  2. Running one of the following versions of JetPack:

    JetPack 5 (L4T r35.x) JetPack 6 (L4T r36.x)

  3. Sufficient storage space (preferably with NVMe SSD).

    • 6.8GB for container image
    • 4.1GB for SD 1.5 model

Setup a container for stable-diffusion-webui

The jetson-containers project provides pre-built Docker images for stable-diffusion-webui. You can clone the repo to use its utilities that will automatically pull/start the correct container for you, or you can do it manually.

git clone https://github.com/dusty-nv/jetson-containers
bash jetson-containers/install.sh

Info

JetsonHacks provides an informative walkthrough video on jetson-containers, showcasing the usage of both the stable-diffusion-webui and text-generation-webui. You can find the complete article with detailed instructions here.

How to start

Use jetson-containers run and autotag tools to automatically pull or build a compatible container image:

jetson-containers run $(autotag stable-diffusion-webui)

The container has a default run command (CMD) that will automatically start the webserver like this:

cd /opt/stable-diffusion-webui && python3 launch.py \
  --data=/data/models/stable-diffusion \
  --enable-insecure-extension-access \
  --xformers \
  --listen \
  --port=7860

You should see it downloading the model checkpoint on the first run.

Open your browser and access http://<IP_ADDRESS>:7860

Results / Output Examples

Stable Diffusion XL

To generate even higher-quality and detailed images, check out the next part of the tutorial that uses the latest Stable Diffusion XL models!

Want to explore using Python APIs to run diffusion models directly? See jetson-containers/stable-diffusion.