AI painting local deployment Stable Diffusion web UI

AI painting local deployment Stable Diffusion web UI

1. Project introduction

A browser interface based on Gradio library for Stable Diffusion.

Project address: GitHub - AUTOMATIC1111/stable-diffusion-webui: Stable Diffusion web UI

Insert image description here

This is a GitHub project that can generate drawings by directly entering descriptive text. By deploying this project on your local computer, you can enter the text you want to describe on the interactive page, that is, on the browser, and then generate some corresponding pictures.

The interesting thing about this project is that you don’t have to know how to draw, but you can use text descriptions to let the model generate the pictures you want to generate. How close the finished drawing is to what you want it to look like will be affected by the descriptive words you enter.

2. Basic hardware and software environment

First, deploying this project requires a certain operating environment, which is the same as installing a game and is not complicated:

1.4GB or more video memory. A computer with a Windows system, preferably with an NVIDIA graphics card, generally has more than 4GB of graphics card memory. The size of the video memory has a certain relationship with the drawing speed and drawing quality after deployment.

2.git client. Used to clone and update projects on GitHub.

3.python client. Used to build the basic system environment for project operation. The current project recommends using version 3.10.6 of python.

The required python and git can be downloaded and installed by clicking on the project address page.
Insert image description here

Dependencies · AUTOMATIC1111/stable-diffusion-webui Wiki · GitHub

pictures or

3. Clone project

First determine the storage location of a project, any disk will do. After setting a disk, such as drive F, right-click on a blank location and select Git Bash here, you will see the git client page pop up, copy and paste:

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

Enter. After 100% completion, you will find a folder named stable-diffusion-webui on the selected disk. This is the basic open source source code of the project.

4. Build a specific python environment

The purpose of this step is to install some third-party libraries that are specifically needed for the project. Just like making a dish, the pot (python), shovel (git), and ingredients (clone project) are all ready, but some condiments are still needed. The spice is some third-party support libraries. Just install these libraries.

In fact, if the network is smooth, this project can automatically install the required environment with one click. Open the stable-diffusion-webui folder, find the webui-user.bat file, double-click it, and a command line will pop up. Page CMD, wait for automatic installation. After a while, the command line page appears:

“Running on local URL: http://127.0.0.1:7860”

You're done. Copy the address to any browser and open it to see the project page. But in fact, due to network environment problems, it is basically difficult to complete the installation directly and smoothly.

The main purpose of today is to first have a general understanding of such a project and what you can do with it. You can use it to draw, let the project draw for you, and you can draw through text description. Tomorrow we will continue to introduce how to complete the project environment configuration step by step through manual installation.

"How to manually install the python environment of Stable Diffusion web UI"

1. Confirm that python is installed successfully

First confirm whether python is installed successfully.

Open the CMD command prompt application that comes with Windows, type python, if it is displayed

Python 3.10.6

That means the installation is successful.

2. Create a virtual environment folder

The purpose of this step is to establish a system environment for project running on the local disk of the personal computer to store some third-party support libraries.

1. Open CMD and enter the stable-diffusion-webui folder that you cloned before. For example, the previous article said it was on the F drive, then type F on the CMD command line:

The command line will change to F:>
, which means you have entered the F drive, then type cd stable-diffusion-webui

The command line becomes F:\stable-diffusion-webui>

2. Then type python -m venv venv

At this time, open the stable-diffusion-webui folder on the F drive and you will see that there is a new folder named venv in the folder. Continue to open and enter venv\Lib\site-packages. This folder is where the project software will store third-party libraries.

3. Continue to type Scripts after F:\stable-diffusion-webui>, and the command line becomes

Type activate when F:\stable-diffusion-webui>Scripts>, and the command line will become

(venv)F:\stable-diffusion-webui>Scripts>

Now you can start the installation.

3. Install third-party libraries

There is a requirements.txt notepad file in the stable-diffusion-webui folder. This notepad contains some things needed to run the project.

Keep typing

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

At this time, the command line will continue to download and install some files. Just wait. At this time, you can see that the files in the venv\Lib\site-packages folder continue to increase.

Wait for the installation to complete. Just continue to install some other files.

4. Install files in the project root directory

Close cmd, reopen it and enter the stable-diffusion-webui folder again, type mkdir repositories after F:\stable-diffusion-webui>

You can see that there is a new folder named repositories in the root directory.

Continue typing separately

git clone https://github.com/CompVis/stable-diffusion.git repositories/stable-diffusion
git clone https://github.com/CompVis/taming-transformers.git repositories/taming-transformers
git clone https:// github.com/sczhou/CodeFormer.git repositories/CodeFormer
git clone https://github.com/salesforce/BLIP.git repositories/BLIP
pip install git+https://github.com/crowsonkb/k-diffusion.git
Wait The installation is complete. This process may take several attempts to complete due to the network environment.

5. Download the model

Download the model on huggingface, such as v1-5-pruned.ckpt and put it in the root directory\models\Stable-diffusion folder.

Insert image description here

6. Start the project

When the above is successfully completed, open the stable-diffusion-webui folder, find the webui-user.bat file, double-click it, and a command line page CMD will pop up. Wait for automatic installation. After a period of time, the command line page will appear. :
"Running on local URL: http://127.0.0.1:7860"
and you're done.

7. Digression

Here I only provide a personal idea of ​​manual installation for reference, I hope it can be of some use.
If you have any corrections, please leave a message.

Guess you like

Origin blog.csdn.net/Climbman/article/details/133458239