【AI Tools】-Stable Diffusion Localization Deployment Tutorial

foreword

Today we are going to introduce Stable Diffusion, the most popular AI drawing software nowadays. Although Diffusion.ai has opened the API, we need to buy a lot of gold coins for long-term commercial calls. So we need to find a replacement AI drawing platform. Now the AI ​​drawing software in the mainstream market is mainly OpenAI's DALLE, midjourney and Stable Diffusion to learn today, and the first two can only be called through api in commercial use. It costs a lot of money, so today I will take you to use Stable Diffusion to build your own open AI drawing software

Technology Introduction

First of all, we need to understand that Stable Diffusion is an AI painting software, so it needs very powerful GPU computing power and CPU computing power, so ordinary laptops or PCs cannot run it, and my next case operation will use cloud services Platform or third-party scripting platform to build Stable Diffusion. If you have the ability, you can buy a powerful GPU metal cloud or deploy it on your own workstation. The tutorial is completely universal, so let’s start without further ado.

Preparation

1. Download the Stable Diffusion-v1.5 model

Download link: https://huggingface.co/runwayml/stable-diffusion-v1-5

image-20230619155429817

Download problem description:

image-20230619155629410

In the official documentation, the technicians have introduced that there are two lines of defense provided by the installed version of Stable Diffusion:

  1. 4.27GB corresponds to a computer with less VRAM memory
  2. The 7.7GB version corresponds to a computer with higher VRAM memory

Then here is a popular science: what is VRAM?

VRAM (Video Random Access Memory) is a special type of memory designed to handle computer graphics. It is used as a buffer between a graphics processing unit (GPU) and a computer display, storing image data being processed or about to be displayed. This includes 3D model data, textures, framebuffers, etc.

The capacity of VRAM directly affects the size and complexity of the image data that the computer can process. For example, higher VRAM capacity can support larger resolution displays, handle more complex 3D models, or load more textures at the same time. Therefore, it is very important to have a large amount of VRAM for applications that process large amounts of graphics data, such as high-end video games, professional graphic design, and 3D modeling.

However, VRAM isn't the only factor affecting graphics performance. Graphics performance is also affected by the processing power of the GPU (i.e. the number of cores and clock speed inside it) and the speed at which data can be transferred between it and main system memory.

Summarize:

So here you have to check your graphics card and computer virtual capabilities, don't try to overclock rendering at will, your computer will be irreversibly damaged

2. Download the Python installation environment

Because the subsequent service operation, image generation and GUIWEB interface all require the Python runtime library, we need to install it in advance. The Python installation tutorial is attached below.

1. Enter the official website

https://www.python.org/downloads/

2. Download the installation package

image-20230615104111829

3. Install

image-20230615104543732

image-20230615104737525

Explain some limitations of your computer on python, click on it and confirm the permissions

image-20230615105207629

When this appears, the installation is complete

image-20230615105324819

4. Test verification

image-20230615105430840

ext

Appearing this means that the installation is complete. If you want to exit: exit() or Ctrl+Z press Enter

3. Git installation

Git needs to check out related codes in subsequent operations. For example, the SD-WebGui we want to use is an open source project stored on github, and the installation tutorial is attached below

image-20230619160314777

image-20230619160339819

After the download is complete, verify the git environment configuration

4. Download the stable-diffusion-webui repository

webui is the ui interface we use to generate images. We can better debug parameters, generate content and other operations, and even customize the interface, because it is a completely open source project. The interface is as follows:

image-20230619160740070

Good nonsense, let's download:

webui warehouse location

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

You can check out the project in the working directory on the computer. There will be a connection reset problem during my operation. You can use the method of manually downloading the zip package

image-20230619161337847

image-20230619161313321

Unzip the file after the download is complete:

image-20230619161439536

This is the installation file of our webUI, double-click to run it (I personally recommend not to run it as an administrator, it will make mistakes)

image-20230619161927300

In this way, your webui interface is being installed. This process will be a bit slow, because the downloaded file is a bit large, so you need to wait patiently...

During the installation process, you need to press Enter to confirm the content of the downloaded installation package, so pay attention to the installation process, and the cpu will be used to test the rendering during the installation process, it will be very laggy, which is normal

image-20230619163056091

5. Run and open WebUI

Before running, copy and paste the model we downloaded before to the model in the directory—"stable-Diffusion directory

image-20230619165517652

Then run webui.bat, the following effect appears:

image-20230619165640159

It means that our ui is already running on port 7860 and can be operated

image-20230619165719228

6. Chinese ui interface

Enter the github interface:

https://github.com/VinsonLaro/stable-diffusion-webui-chinese

Then copy the address of the project:

image-20230619165812038

image-20230619165844486

After the installation is complete, enter the panel settings: Settings

image-20230619165914565

After the setting is complete, our panel is the Chinese interface.

image-20230619165933025

Finish

Through these means, we have installed SD on the local computer, and then we can start generating AI drawings by training the model~

In the next issue, we will teach you how to train the model and how to generate pictures

Guess you like

Origin blog.csdn.net/gjb760662328/article/details/131291511