This tutorial is for Stable Diffusion 2.0
local 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 pagekgithub
with
or: add parameters-i https://pypi.tuna.tsinghua.edu.cn/simple
and download from the mirror source
- Requirements
Python 3.10.6
- Create and enter
conda
the environment
conda init
conda create --name sd2 python=3.10.6
conda activate sd2
cd ./sd2
- clone project
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
Alternative example:
git clone https://kgithub.com/AUTOMATIC1111/stable-diffusion-webui
- install dependencies
- Enter Pytorch official website to install version 2.0.0
torch
:
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
- (Optional) Modify the startup script
Open it with Notepad webui-user.bat
and modify COMMANDLINE_ARGS
the startup parameters:
set COMMANDLINE_ARGS= --deepdanbooru --xformers --port 7890 --theme dark --share
Detailed parameter explanation:
--xformers
Reduce video memory usage, increase running speed, and accelerate image generation, only applicable tonvidiagpus
--deepdanbooru
The function of graphic text is enabled, which is mainly used for data processing before training, which is not very useful here--port 7890
access port 7890--theme dark
black theme--share
An 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
- 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. github
The solution here is to change all the download addresses tokgithub
- open with notepad
launch.py
Ctrl + F
Findgithub
and enterprepare_environment()
Change ingithub
tokgithub
- save and exit
- Re-execute the startup script
webui-user.bat
- open project
URL
local URL
It is a local address, which can only be accessed by this machine.
public URL
It is a public network address, which--share
can be obtained by adding parameters
-
successful access
-
Recommendations
- update project
cd ./sd2
git pull
-
Pre-trained model download address
-
Pre-trained model storage location
*.ckpt
and*.safetensors
stored instable-diffusion-webui/models/Stable-diffusion/
the directory*.vae.ckpt
storestable-diffusion-webui/models/VAE/
in directory
-
GFPGAN
is used to repair and draw faces, reducing the distortion and deformation of stable diffusion faces.