Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

Time:2023-11-17

Article Series Catalog

Stable Diffusion Interface Parameters and Model Use

Google Colab Cloud Deploys Stable Diffusion for Mapping



preamble

Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

Recently, intelligent AI painting with its low cost, high efficiency, multi-style, easy to operate and other characteristics of the explosion of the whole network, the original painting, graphic design and other fields caused a huge impact, it is reported that many companies (especially game companies) have introduced AI painting workflow, and even more have laid off half of the company’s original painter.
Taking advantage of the AI painting learning craze, I can’t wait to experience the Stable Diffusion WebUI, which is claimed to be the strongest in the industry.
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully


I. What is Stable Diffusion?

Stable Diffusion is an AI mapping software (open source models) that can be deployed locally, can switch between multiple models and new models and open source libraries are being updated and released every day, and most importantly, it’s free, with no limit on the number of drawings.

II. Preparation before installation

1. Check whether your computer configuration meets the requirements

Computer with at least 2G of video memory

Tips: How to check the size of your computer’s video memory:
Right click on Windows [Start], select [Task Manager (T)], select [GPU] in the [Performance] column to view “Dedicated GPU Memory”.
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

2. Download and install Git

https://git-scm.com/
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

Tip: Git is a free, open source distributed version control system
Clicking on Git Bash Here opens the Git Terminal

Check if your computer has installed Git: [Win+R] call out [Run], type “cmd”, enter, and in the command line enter

git --version

As shown in the figure below, a version number indicates that it has been installed.
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

3. Download and install Python

Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Better download this version
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Note that you have to check this option to add python to the system environment variable PATH
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Since I installed python when I was in school, I was afraid that the old version would not support Stable Diffusion, so I also took the opportunity to update the version.

Check whether there is a successful upgrade: [Win + R] call out [Run], enter “cmd”, enter, in the command line enter

python --version

As shown in the figure below, the version number appears, successfully upgraded to version 3.10
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully


Download the stable-diffusion-webui repository

https://github.com/AUTOMATIC1111/stable-diffusion-webui
Create a new folder in the disk with more space, such as the folder named [AI] in the following picture, and then click the right mouse button in this folder, select [Git Bash Here] to open the Git terminal.
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
As you can see in the following figure, a Git terminal has been successfully opened
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

Downloading code via Git command cloning

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

Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Problems arise:
OpenSSL SSL_read: Connection was reset, errno 10054

Solution:
Turn off git’s https certificate validation

git config --global http.sslVerify false

After that clone the code again, successfully!
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
You can also see that the folder has been downloaded
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

Four, run webui-user.bat

Find it in the downloaded folder above and double click to run it
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Downloading
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
New problem: prompt for pip update?
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Solution:
To upgrade the pip command, you can reopen a command line and run the green command it prompts once (this command varies from person to person because folder names can be different)

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

Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
After that reopen webui-user.bat again

Because I did not use the magic Internet in the installation process, so in the download process there is a gfpgan, clip, open clip did not install the successful prompt, or the reason for the domestic network environment, the solution:
Edit the launch.py file in the stable-diffusion-webui directory
For example, if you are stuck at gfpgan, find the line where run_pip(f “install {gfpgan_package}”, “gfpgan”) is located, as shown below in line 263 of the launch.py file, and change it to run_ pip(f “install -i https://pypi.douban.com/simple/ {gfpgan_package}”, “gfpgan”), save and close after modification, go to domestic mirror source (-i https://pypi.douban.com/simple/) to improve download speed

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

Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

After that, save the launch.py file and open webui-user.bat again.
(Every time there is a problem with the download, change the corresponding content in the launch.py file, e.g. if there is a problem with clip change run_pip(f “install {clip_package}”, “clip”) to run_pip(f “install -i {clip_package}”, “clip”)), gfpgan, clip, gfpgan, clip, gfpgan, gfpgan, gfpgan, clip, and clip. ) to run_pip(f “install -i https://pypi.douban.com/simple/ {clip_package}”, “clip”)) in the launch.py file, gfpgan, clip, open clip all do the same thing, and so on and so forth (modify launch.py, close command line, reopen webui-user.bat)

If it’s still stuck, find the prepare_environment() section in the launch.py file at the corresponding https //github.moeyy.xyz/
Accelerating git by proxy
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

After many modifications, shutdowns, and reboots, it finally came to the Web UI here
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
If all goes well, the next step is to download a big 3.97 gigabyte thing, and if you get stuck in the middle of it, it’s better to close the command line and reopen webui-user.bat
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
After a while of waiting, the progress bar finally filled up and what we were most hoping for appeared
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Indicates that a service is started on the local computer on port 127.0.0.1:7860
Copy http 7860 into your browser and open it to the Stable Diffusion interface

Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
Try generating a little girl with the base model. The speed of generation depends on the computer configuration.
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully
emmm, oozes an eerie beauty
Generate another tiger and see
Local deployment of Stable Diffusion tutorial, pro-test can be installed successfully

summarize

Increase the speed and stability of your downloads by going to domestic mirrors.
The next blog proposes to introduce the interface parameters of Stable Diffusion to try out other models.
Finish scattering flowers, thanks for watching!

Recommended Today

Resolved the Java. SQL. SQLNonTransientConnectionException: Could not create connection to the database server abnormal correctly solved

Resolved Java. SQL. SQLNonTransientConnectionException: Could not create connection to the database server abnormal correct solution, kiss measuring effective!!!!!! Article Catalog report an error problemSolutionscureexchanges report an error problem java.sql.SQLNonTransientConnectionException:Could not create connection to database server Solutions The error “java.sql.SQLNonTransientConnectionException:Could not create connection to database server” is usually caused by an inability to connect to the […]