[Mufubai Tutorial] Windows system local deployment stable-diffusion-webui


This tutorial is for Stable Diffusion 2.0local deployment, the system environment isWindows


Note: This tutorial does not include the installation of anaconda/miniconda, python, git, cuda

Tip:github Due to the domestic network, github cannot be connected stably. At this time, replace the on the web page kgithubwith
or: add parameters -i https://pypi.tuna.tsinghua.edu.cn/simpleand download from the mirror source

  1. Requirements
Python 3.10.6
  1. Create and enter condathe environment
conda init
conda create --name sd2 python=3.10.6
conda activate sd2
cd ./sd2
  1. clone project
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

Alternative example:

git clone https://kgithub.com/AUTOMATIC1111/stable-diffusion-webui
  1. install dependencies
pip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu117
  • install dependencies
cd ./stable-diffusion-webui
pip install -r requirements_versions.txt
pip install -r requirements.txt 

Image source download example:

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

If the plug-in is installed, you need to enter the plug-in directory to install the plug-in dependencies. The plug-in storage location is./stable-diffusion-webui/extensions

  1. (Optional) Modify the startup script

Open it with Notepad webui-user.batand modify COMMANDLINE_ARGSthe startup parameters:

set COMMANDLINE_ARGS= --deepdanbooru --xformers --port 7890 --theme dark --share 

Detailed parameter explanation:

  • --xformersReduce video memory usage, increase running speed, and accelerate image generation, only applicable tonvidiagpus
  • --deepdanbooruThe function of graphic text is enabled, which is mainly used for data processing before training, which is not very useful here
  • --port 7890access port 7890
  • --theme darkblack theme
  • --shareAn additional temporary public network address is generated for program access, the address is valid for 72 hours, and the address will change every time you restart
  1. Start the script, you need to wait for the background download
webui-user.bat

Solve the problem of reporting errors or not loading for a long time:

The cause of the problem is still the reason of the domestic network, and it cannot be accessed. githubThe solution here is to change all the download addresses tokgithub

  • open with notepadlaunch.py
  • Ctrl + FFind githuband enter
  • prepare_environment()Change in githubtokgithub

launch

  • save and exit
  • Re-execute the startup script
webui-user.bat
  1. open projectURL

URL

local URLIt is a local address, which can only be accessed by this machine.
public URLIt is a public network address, which --sharecan be obtained by adding parameters

  1. successful access

  2. Recommendations

  • update project
cd ./sd2
git pull
  • Pre-trained model download address

  • Pre-trained model storage location

    • *.ckptand *.safetensorsstored in stable-diffusion-webui/models/Stable-diffusion/the directory
    • *.vae.ckptstore stable-diffusion-webui/models/VAE/in directory
  • GFPGAN
    is used to repair and draw faces, reducing the distortion and deformation of stable diffusion faces.

Guess you like

Origin blog.csdn.net/qq_43377653/article/details/130658464