How to Run Stable Diffusion on your PC to Generate AI Images?

3
How to Run Stable Diffusion on your PC to Generate AI Images
How to Run Stable Diffusion on your PC to Generate AI Images

Stable diffusion is a method for generating images with high-quality artificial intelligence. It’s one of the most popular techniques for generating realistic images of applications and objects. 

If you want to generate AI images, one of the methods is to use stable diffusion. But this process can be relatively slow and consuming a lot of resources. In this post, we’ll look at how to run stable diffusion on your PC and get some of these results in an easier way.

What Is Stable Diffusion?

Stable Diffusion is a text-to-image deep learning model that was released in 2022. It is mostly used to generate detailed graphics based on word descriptions, but it may also be used for inpainting, outpainting, and making image-to-image conversions driven by a text prompt.

Stable Diffusion is a deep generative neural network model developed by the CompVis group at LMU Munich. The model was developed by Stability AI, CompVis LMU, and Runway, with assistance from EleutherAI and LAION. Stability AI received $101 million in funding in October 2022, sponsored by Light-speed Ventures and Coatue.

Requirements for Running Stable Diffusion on Your PC

Although it has an online version, Stable Diffusion varies from most AI art models in that it can also be downloaded and used on a PC. Other AI models rely on pricey, far-off servers and are web-based. We have outlined some of the primary Stable Diffusion system requirements if you wish to run a high-end AI art generator offline.

Graphics Processing Unit

You require a top-tier consumer graphics processing machine to run Stable Diffusion locally on your PC (GPU). GPUs are specialized processors made to accelerate the rendering of visuals. GPUs are required to create high-quality art since AI art models are employed to make images.

Stability AI advises utilising an Nvidia graphics card for the time being. It can more quickly analyse data, cutting down on the time needed to render an image from a text prompt. Other GPUs like Apple Silicon and AMD will be able to adapt to Stability Diffusion thanks to Stability AI.

Memory

Stability AI developed Stable Diffusion to surpass the limitations of pre-existing AI art models. The creators of Stability AI had a dream of building the best open-source AI system possible, one that could build websites and apps and influence the creative potential of people.

Thus, they made the decision to develop an AI model that users could download and use on their PCs at home. They advise using gaming laptops with the appropriate additional memory because creating graphics using AI models requires a lot of processing power.

Stable Diffusion Size

Stable Diffusion’s code, which is roughly four GB in size, must be downloaded before it can be used on your computer. You may also need to install a third-party Python application or utilize Windows Subsystem for Linux. This is because text inputted via the Linux Command Line is utilised to train the algorithm to create graphics.

VRAM

VRAM is the name for the memory that stores image data for graphic displays. It makes it possible for AI art models to generate high-resolution images without difficulty using seed images or text prompts. The resolution of the images that the AI model generates increases with VRAM size.

Stability To download and use Stable Diffusion, AI mandates that your GPU must have a VRAM of at least 6.9 gigabytes (GB). A Nvidia graphics card may supply this type of VRAM, which is less of a need than for other AI art models.

Can Stable Diffusion be run without a GPU?

Yes, Stable Diffusion may be run without a GPU. There are three methods to do this:

  • Utilizing the website Hugging Face.
  • Utilizing Google Colab Pro usage.
  • Utilizing the website for DreamStudio Lite.

Follow these easy steps to Run Stable Diffusion:

The DreamStudio web app is one of the simplest methods to run Stable Diffusion. Stability AI, the same firm that produced Stable Diffusion, developed DreamStudio Lite. You can make any image you can “dream” with the DreamStudio interface.

To run Stable Diffusion in DreamStudio, follow these steps:

  1. Visit the DreamStudio website.
  2. Make an account.
  3. Type your text into the textbox towards the bottom, close to the “Dream” button.
  4. Once you’ve submitted your input to build the image, click the Dream button. Your picture will be ready in 5 seconds.

That’s all! By clicking the download icon in the center of the generated image, you may download the image you created. There are a few parameters on the right side that you may change, such as the image resolution and the quantity of photographs to be created.

When users sign up for DreamStudio, they receive 200 credits. With this, you may make 200 free photos with a resolution of 512×512 using the DreamStudio online software. Following that, you must pay £1 ($1.18) to acquire 100 generations.

NSFW filters are applied to the images created by this programme, therefore if you try to make NSFW images, you will obtain a completely blurred image.

Use Colab to run Stable Diffusion

Stable Diffusion may now be accessed remotely using Google Colab. The catch is that you will need a Colab Pro account to make photos because the free version of Colab has somewhat insufficient VRAM.

It’s worth mentioning that this application has its own NSFW filter. However, there is a workaround for creating NSFW images on Stable Diffusion using Google Colab.

How To Run Stable Diffusion locally on your PC to generate AI Images?

You can use your PC to run Stable Diffusion locally if your GPU has at least 6GB of VRAM. The Stable Diffusion runtime issue may appear if your GPU does not have sufficient VRAM.

Although the steps to run the model may appear to be a little difficult to understand, they are actually simple to follow and can be completed with a little work. You must complete the following steps.

Downloading and installing Stable Diffusion

  1. Go to Huggingface.co, click Sign Up (top bar) and create an account.
  2. Now at the top bar search for “CompVis/stable-diffusion-v1-4” and select Files and versions tab. Download the sd-v1-4.ckpt file (The file is more than 4GB).
  3. To download, click on Code (green button) and select Download ZIP. Unzip it after the download completes. 
  4. Navigate to “stable-diffusion-main/models/ldm” after unzipping the file. Make a folder called “stable-diffusion-v1” in that location. Rename the sd-v1-4.ckpt file to “model.ckpt” and place it in the folder you created (stable-diffusion-v1).
  5. In Notepad, open the file environment.yaml and add “- git” after the line that says “dependencies:”. The “-” should be aligned with the ones in the lines that follow.
  6. Now Download Miniconda 3 for Windows by visiting https://docs.conda.io/en/latest/miniconda.html
  7. Miniconda should be installed for all users. Remove the check mark next to “Register Miniconda as the system Python 3.9.”

Generating the Ai images

Follow the steps given below to generate AI images:

  1. Open Miniconda 3, then type “cd” and drag the folder into the Anaconda prompt console.
  2. Run the following command: “conda env create -f environment.yaml.” Before proceeding, ensure that you are in the stable-diffusion-main folder.
  3. Run the following command: “conda activate ldm”.
  4. To generate an image, use the following command: “python scripts/txt2img.py “Elon mask is red space” —H 512 —W 512 —seed 27 —n iter 2 —ddim steps 50 “.
  5. Replace the Elon Musk statement with the image you want to make for custom images.

Conclusion

Stable Diffusion separates out among AI art models since you can use it to run the algorithm-generated artwork locally on your PC until you are happy with the results. You can create amazing artwork anywhere if you already have a strong gaming laptop.

Previous articleHow to Optimize PC for Gaming
Next articleBook of Stamps Cost 2022, Numbers, and Details