Have no idea how to access Stable Diffusion using Google Colab? We have got you covered!
Today, we are going to look at how to access Stable Diffusion via Google Colab and generate images from our text. Let's get into it!
How To Access Stable Diffusion Using Google Colab
To run Stable Diffusion on your PC, at least 6GB of VRAM (GPU) is required to get decent results. Most of us don't have that much VRAM available on our PCs and that's where Google Colab comes in.
Google Colab is a cloud-based coding environment which will provide you with a computing infrastructure powerful enough to run Stable Diffusion. The caveat, however, is that you will need Colab Pro in order to run Stable Diffusion since the free version has slightly too little VRAM for sampling.
Assuming that you have Google Colab Pro, let's get started.
Setting up Stable Diffusion
Google Colab might seem intimidating at first. You might get overwhelmed by the code, and it might be hard to figure out what’s going on. Well, you don't need to understand the code. All you have to do is press some buttons. We will explain everything!
- Go to this Google Colab Notebook.
- As mentioned in the Notebook, the next step is to make sure your Hardware accelerator is GPU and the Runtime Shape is set to High-RAM. To do that:
- In the top left-hand corner of the window, click Runtime > Change runtime type.
- Now make the necessary changes and hit Save.
- Then we need to set up Stable Diffusion. To do that:
- Click on the down arrow icon on the left of "Setup" to unexpand the block. Boom! All the confusing codes are gone now.
- Then, hit the play button to run the block of code.
- Wait for it to finish execution. It may take a while.
When that's done, you can start generating images (unless you run into any errors). It is as easy as that! Keep reading to see how to generate images with Stable Diffusion using Google Colab.
Read More: How To Use MidJourney AI
Generating images with Stable Diffusion
Congratulations! You have successfully set up Stable Diffusion and now it is time to create art. In order to generate images, you must give your text or prompt. Let's see how you can do that.
You are now probably staring at a block of code identical to the one in the above image. As you might have figured out already, you need to give your text or prompt in " " next to the --prompt command.
For example: --prompt "iron man making breakfast"
Once you have inputted your prompt, hit the play button to run the block of code. Your image will be generated in seconds. Changing --ddim_steps will give a better picture that more closely matches your prompt but it will take more time to generate.
It is also worth mentioning that this tool comes with an NSFW filter. To generate NSFW images, you need to run Stable Diffusion locally on your PC.