Deploy the Stable Diffusion tutorial locally, the pro-test can be installed successfully

Series Article Directory

Stable Diffusion interface parameters and model usage

Google Colab Cloud Deploys Stable Diffusion for Drawing



foreword

The author uses AI tools to imitate the AI ​​work "Castle Starry Night" drawn in the style of Van Gogh

Recently, intelligent AI painting has become popular all over the Internet due to its low cost, high efficiency, multiple styles, and easy operation, which has had a huge impact on original painting, graphic design and other fields. It is reported that many companies (especially game companies) have already applied AI painting Introducing a workflow, what's more, half of the company's original artists have been laid off.
With the upsurge of AI painting learning, the author can't wait to experience the Stable Diffusion WebUI, which is known as the strongest in the industry
official steps


1. What is Stable Diffusion?

Stable Diffusion is an AI drawing software (open source model), which can be deployed locally and can switch between multiple models. New models and open source libraries are updated and released every day. The most important thing is that it is free and there is no limit on the number of drawings.

2. Preparation before installation

1. Check whether your computer configuration meets the requirements

Computer memory at least 2G or more

Tips: How to check the video memory size of your computer:
Right-click on Windows [Start], select [Task Manager (T)], select [GPU] in the [Performance] column to view "Dedicated GPU Memory"
insert image description here

2. Download and install Git

https://git-scm.com/
insert image description here
insert image description here

Tips: Git is a free, open source distributed version control system
Click Git Bash Here to open the Git terminal

Check whether Git has been installed on your computer: [Win+R] to call out [Run], enter "cmd", press Enter, and enter in the command line

git --version

As shown in the figure below, if the version number appears, it means that it has been installed
insert image description here

3. Download and install Python

insert image description here
It is best to download this version.
insert image description here
insert image description here
Note that you must check this option and add python to the system environment variable PATH.
insert image description here
insert image description here
Because I installed python when I was in school, I am afraid that the old version does not support Stable Diffusion, so I also take this opportunity to update the version.

Check whether the upgrade is successful: [Win+R] to call out [Run], enter "cmd", press Enter, and enter in the command line

python --version

As shown in the figure below, the version number appears, successfully upgraded to version 3.10
insert image description here


3. Download the stable-diffusion-webui warehouse

https://github.com/AUTOMATIC1111/stable-diffusion-webui
Create a new folder in a disk with a relatively large space, as shown in the picture below named [AI] folder, then click the right mouse button in this folder, select [ Git Bash Here] Open the Git terminal,
insert image description here
as shown in the figure below, successfully opened a Git terminal
insert image description here

Clone and download the code through the Git command

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

insert image description here
Problem occurs:
OpenSSL SSL_read: Connection was reset, errno 10054

Solution:
Turn off git's https certificate verification

git config --global http.sslVerify false

Then clone the code again, success!
insert image description here
At the same time, you can see that the folder is also downloaded
insert image description here

4. Run webui-user.bat

Find it in the downloaded folder above, double-click to run it. A new problem appears
insert image description here
during the download : Prompt for pip update? Solution: To upgrade the pip command, you can reopen a command line and run the green command it prompts once (because the folder name may be different, this command varies from person to person)
insert image description here

insert image description here

H:\AI\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip

insert image description here
After that reopen webui-user.bat again

Because the author did not use magic to surf the Internet during the installation process, there was a prompt that gfpgan, clip, and open clip were not successfully installed during the download process, or the reason for the domestic network environment. Solution: edit the stable-diffusion-webui directory
. For example, if the launch.py ​​file
is stuck in gfpgan, find the line where run_pip(f"install {gfpgan_package}", "gfpgan") is located, as shown in line 263 of the launch.py ​​file as shown below, and change it to run_pip(f"install - i https://pypi.douban.com/simple/ {gfpgan_package}”, “gfpgan”), save and close after modification, and use the domestic mirror source (-i https://pypi.douban.com/simple/), improve download speed

run_pip(f"install -i https://pypi.douban.com/simple/ {gfpgan_package}", "gfpgan")

insert image description here

Then save the launch.py ​​file and open the webui-user.bat again
(every time there is a problem with the download, modify the corresponding content in the launch.py ​​file, for example, if there is a problem with the clip, just run_pip(f"install { clip_package}", "clip") to run_pip(f"install -i https://pypi.douban.com/simple/{clip_package}", "clip")), gfpgan, clip, open clip are the same Operation, so repeatedly (modify launch.py, close the command line, reopen webui-user.bat)

If it is still stuck, find the prepare_environment() part in the launch.py ​​file, and add https://github.moeyy.xyz/ in front of the corresponding https://github.com/ to
accelerate through the proxy git
insert image description here

After many revisions, shutdowns, and restarts, I finally came to the Web UI.
insert image description here
If everything goes well, the next step is to download a 3.97G big thing. If you get stuck in the middle, close the command line and reopen webui-user.bat
insert image description here
insert image description here
. After waiting for a while, the progress bar finally filled up, and the content we most wanted to see appeared. It
insert image description here
means that the local computer has started a service, and the port is 127.0.0.1:7860.
Copy http://127.0.0.1:7860 to the browser Open it in the browser and enter the Stable Diffusion interface

insert image description here
Try to generate a little girl with the basic model, the generation speed depends on the computer configuration
insert image description here
emmm, revealing a strange beauty,
and then generate a tiger to see
insert image description here

Summarize

Improve download speed and stability by using domestic mirroring.
The next blog will introduce the interface parameters of Stable Diffusion and try other models.
It's over, thank you for watching!

Guess you like

Origin blog.csdn.net/weixin_43905975/article/details/129988104