Windows10 AUTOMATIC1111 / stable-diffusion-webui local deployment

Windows10 AUTOMATIC1111 / stable-diffusion-webui local deployment

Article directory

  • Windows10 AUTOMATIC1111 / stable-diffusion-webui local deployment
  • foreword
  • 1. Preliminary preparation
    • 1. Python
    • 2. git
    • 3.stable-diffusion-webui repository
    • 4. Model
    • 5. Required documents
  • 2. Deployment steps
    • 1. Install Python
    • 2. Install git
    • 3.stable-diffusion-webui repository
    • 4. Modify the webui-user.bat file
    • 5. Place the model and related files
    • 6. Run webui-user.bat
  • 3. Introduction to Visual Interface Operation
    • 1. Change Chinese
    • 2. Brief introduction of the page
    • 3. General prompt words
  • End of article

Foreword

A very simple preface, this is an article that briefly introduces the deployment process. Sorry for any incompleteness.
The following is a brief introduction to some nouns based on the information on the Internet:
stable diffusion is a text to image generation model based on latent diffusion models (Latent Diffusion Models), which can generate high-quality, high-resolution, and high-fidelity images based on arbitrary text input.
The stable-diffusion-webui of AUTOMATIC1111 is an offline framework based on stable diffusion that can be easily deployed. In fact, it encapsulates the UI and some functions, allowing us to use SD to create paintings through a visual interface instead of command line parameters.
The use of stable-diffusion-webui requires us to download the trained model first, and according to the model used, a picture of the style of the used model will be generated. The download method of the model will be introduced next.
The specific process of deploying stable-diffusion-webui will be introduced in detail below.

1. Preliminary preparation

Before starting the deployment, we can prepare some needed things first.

1. Python

Please note that to ensure accuracy, the Python version is at least 3.10.6, click here to download directly
If you want to use a higher version of Python, you can also go to the official website to download

2.git

Git will be used in the subsequent deployment process, click here to download directly

3.stable-diffusion-webui repository

There are two cases, you can use git to directly import the library to the local, or you can go to github to download the warehouse yourself,
The way to use git will be introduced in the next process, and the situation of direct download is introduced here. Click here to enter the github page
Click Code / Download ZIP as shown in the figure below, you can also click here to download directly

4. Model

stable-diffusion-webui requires a trained model before it can be used. The download addresses of some models are provided below:

  • Model sd-v1-4 provided by framework ontology
    • Click to go to the GitHub page
    • download huggingface
  • waifu-diffusion-v1-3 is suitable for two-dimensional painting style
    • download huggingface
  • Inkpunk Diffusion_v2 Inkpunk style
    • download huggingface
    • civitai download

In addition, the following are two commonly used websites for downloading models, you can directly search for model downloads
hugging face
civitai

VAE file will make the image more anthropomorphic Click here to download

In addition, some models that I have used and some “good” models I will put at the end of the article.
Anything-v4.5 is good at manga
chilloutmix Live Effects
CounterfeitV25_25 anime style
dreamlike high quality anime art

5. Required documents

Note, this step can be skipped first! ! !
The stable-diffusion-webui main body needs to download some necessary files when running webui-user.bat for the first time. This step may cause errors due to network problems. If you don’t mind the trouble, you can directly download and install these files first. The download of each dependent file is provided below:

  • BLIP
  • CodeFormer
  • k-diffusion
  • stable-diffusion-stability-ai
  • taming-transformer

Below is the python package

  • gfpgan_package
  • clip_package
  • openclip_package

For the operation steps of the above files, please click here to jump
Of course, I will also put these in the resource integration at the end of the article

2. Deployment steps

1. Install Python

There is nothing to say about installing Python, just remember to check Add Python 3.10 to PATH

2. Install git

There is nothing to say about this, just open the .exe and go to next-> all the way

3.stable-diffusion-webui repository

First of all, in order to prevent you from running out of space when using it, after comprehensive consideration, you need a disk with at least 15G free space to store files, and then create a new folder to store files and rename them.
If you have downloaded stable-diffusion-webui-master.zip from github before, unzip it into the newly created folder.

If you use git, you need to open cmd, use the cd command to enter the corresponding folder, and then use git to pull the library to the local

The git command is as follows:

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

4. Modify the webui-user.bat file

First, we open the local stable-diffusion-webui folder, find the webui-user.bat file, right-click to edit, the following is my content, you can refer to the modification.

@echo off

set PYTHON=C:\Users\Administrator\AppData\Local\Programs\Python\Python310\python.exe
set GIT=
set VENV_DIR=venv
set COMMANDLINE_ARGS=
git pull
start http://localhost:7860/
call webui.bat

It should be noted that after set PYTHON=, fill in the path of the python you installed. If you forget, you can right-click the shortcut to view the properties

If the GPU VRAM is less than 4GB, you can set COMMANDLINE_ARGS=--medvram --opt-split-attentio
If the computer RAM is less than 8GB, you can set COMMANDLINE_ARGS=--lowvram --opt-split-attention
In addition, the git pull command is used to obtain the code from the remote and merge the local version (but frequent updates are not recommended), start http://localhost:7860/ It is to directly open the webpage (visual interface), if it is not refreshed, don’t worry, after the bat is finished running, refresh and the interface will appear.

5. Place models and related files

Place the downloaded model in the corresponding location. Note that the downloaded .ckpt file and .safetensors file are placed in the folder shown in the figure below:

If it is Lora, please remember to put it under the Lora folder in the picture below. (Lora generally has a size of tens to hundreds of M)

Please place the VAE file under the VAE folder in the figure below

6. Run webui-user.bat

Attention! ! ! There may be many problems in this step. Common problems will be explained here, and the remaining problems will be updated and summarized at the end of the article.

First press win + R to open cmd, and then run the command python.exe -m pip install --upgrade pip to upgrade pip. This step is to prevent errors due to insufficient pip version.
Then double-click to run webui-user.bat.
Attention! ! ! Because it will use git to download files by itself, but it is still very likely that it will not be downloaded even if it is scientifically online
At this time, there are several methods:

  1. Using GitHub Proxy,
    Open the launch.py file and add https://ghproxy.com/< before all https://github.com/ under def prepare_environment(): /code>

  2. Using the developer sidecar,
    Visit github to download and click to go to the web page, then open the proxy service, system proxy, Git.exe, and change the pip acceleration in the application to aliyun image



  3. add mirror

  4. Open cmd directly in the scientific online software to run webui-user.bat

  5. Directly download the various files required, please go to the file download for this step
    Steps:
    After the download is complete, please create a new folder and name it: repositories, which is used to place 5 dependent files

    Then decompress all the five dependent file compression packages, remove the -main or -master suffix, name them as shown in the figure, and place them in the repositories folder

    The three python packages listed in the file download are very easy to report errors, so it is recommended to install them yourself. After downloading, extract it to the stable-diffusion-webui\venv\Scripts directory, venv is set VENV_DIR=venv< when editing .bat /code>, so modify it according to your name here.
    The methods of CLIP and open_clip are as follows:
    Open cmd, cd to stable-diffusion-webui\venv\Scripts\open_clip-main or CLIP-main.
    Use G:\stable-diffusion-webui\venv\Scripts\python.exe setup.py build install to install.
    The method of GFPGAN is as follows:
    Open cmd, cd to stable-diffusion-webui\venv\Scripts\GFPGAN-master.
    Use the command G:\stable-diffusion-webui\venv\Scripts\python.exe -m pip install basicsr facexlib to install the dependencies of GFPGAN.
    Then use G:\stable-diffusion-webui\venv\Scripts\python.exe -m pip install -r requirements.txt to install the dependencies of GFPGAN.
    Use G:\stable-diffusion-webui\venv\Scripts\python.exe setup.py develop to install GFPGAN.

Please choose the 5 options provided above according to your own situation. You can surf the Internet scientifically and then double-click to open the webui-user.bat file to try it out. If an error occurs, then download and install the corresponding file according to the corresponding file.
Finally, double-click webui-user.bat. If the following prompt appears in the console, it means success. Finally, refresh the web page and enter the ui interface successfully.

To create a public link, set `share=True` in `launch()`.

3. Introduction to Visual Interface Operation

Here is just a brief introduction to some corresponding settings and basic operations. How to draw a picture that meets your expectations needs to be explored by yourself.

1. Change Chinese

Click Extensions, select Install from URL, then paste the link, and finally click Install, and wait for the application to succeed. The link is as follows

https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN


After the installation is complete, restart the webui, click Settings -> Reload UI


Then check the Chinese extension, and then click Apply and restart UI

Then click Settings -> User interface, slide to the bottom and select zh_CN in the Localization drop-down box.


Finally, go back to the top, click Apply settings, and then click Reload UI to switch to Chinese.

2. Brief introduction of the page

The following is a brief introduction to the interface. In fact, most of them should understand after switching to Chinese. Prompt words are in English and separated by commas, such as

a girl,undercut hair,young

Negative prompts are those you don't want it to generate, such as:

bad hands, missing fingers, bad body,

Among sampling methods, Euler A, DPM2 A, DDIM are recommended
In the number of sampling iterations, the more iterations are not necessarily the better, it can be decided according to the specific sampling method and specific needs. In actual use, it is often necessary to consider comprehensively according to the size of the canvas and whether the target is complex. For a standard canvas like 512*512 and a simple scene without strong refinement requirements, it is usually recommended to use Euler A / DDIM and other medium-step-required algorithms with an iteration number of 30 or above, 40 or below.

3. General prompt words

Front: ((masterpiece)), (((best quality))), ((ultra-detailed)), ((illustration)), ((disheveled hair))
Negative: longbody, lowres, bad anatomy, bad hands, missing fingers, pubic hair, extra digit, fewer digits, cropped, worst quality, low quality

End of article

At present, most of the required files have provided download methods. I have packaged a file for internal communication. Currently, due to special reasons, the download address is not provided. Please contact me if necessary.

syntaxbug.com © 2021 All Rights Reserved.