Easy Way to Run Stable Diffusion XL on Colab using DiffusionMagic

Stable Diffusion XL can be used to generate high-resolution images from text. This tutorial will discuss running the stable diffusion XL on Google colab notebook.

SDXL System requirements

Stable Diffusion XL uses advanced model architecture, so it needs the following minimum system configuration

System RAM: 16 GB

GPU: Nvidia GeForce RTX 20 graphics card (equivalent or higher standard) equipped with a minimum of 8GB of VRAM.

Google colab free tier already meets these requirements. We’ll get 16 GB RAM and Tesla T4 GPU 16GB VRAM.

How to run Stable diffusion XL 1.0

The latest version of DiffusionMagic supports stable diffusion XL 1.0. First, we need to open the following DiffusionMagic GitHub link.

Next, click on the “open in colab” button in the “Stable diffusion XL Colab” section. Run each cell in the colab.

How to run Stable diffusion XL 0.9

DiffusionMagic supports different stable diffusion workflows using diffusers. First, we need to open the following DiffusionMagic GitHub link.

Stable diffusion XL github

Next, click on the “open in colab” button in the “Stable diffusion XL Colab” section. Run each cell in the colab. Then you will see a similar message as shown below.

Stable diffusion XL colab

As StableDiffusion XL is a gated model we need to login to HuggingFace to access the model. We also need to agree to the terms and conditions of model usage. This model is currently intended for research use only.

We need to input the Hugging Face access token. You can create a new access token by opening your HuggingFace account and clicking edit profile then you can see the “Access tokens” menu section. Create a new access token named SDXL with a read role.

Huggingface Access token

Copy the generated access token and paste it to the colab and click login. When you login successfully message you are ready to go to the next step.

Next, you will see “Running on public URL: ” click on the link. You will see a similar interface as shown below.

Now you can type your prompt and generate images. The first time it will take some time to download the model.