Install the Stable Diffusion webui
Renderings:
1. Preparations
Before downloading AI
the painting tool, you need to download some running environments on the computer in advance
1. Download python, git
First of all, the local machine is preferably Nvidia's N card, and it needs at least 4GB
video memory to run locally. Of course, A card can also be played, because drawing has high requirements on the graphics card. Otherwise, even if the installation is successful, the resulting image may be completely black or cannot be drawn at all.
When installing, you need to turn on Magic Internet, otherwise you can't download some dependencies needed for painting
In addition, a local python
environment , and the official Python 3.10.6
version is required to be downloaded
Among python
them the download address: https://www.python.org/downloads/
In addition, installation is required Git
, download address: https://git-scm.com/downloads/
python
After the installation is complete, we run the following command to pip
upgrade to the latest
python -m pip install --upgrade pip
2. Download the Stable Diffusion webui
The first uses Git
the command :
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
The second is to directly download the compressed package file, as shown in the figure below:
3. Run start
After downloading to the local, if you are windows
the system , double-click directly in the folderwebui-user.bat
If you are MACOS
or Linux
system, run the command./webui.sh
It will take a long time to download various dependencies when starting for the first time, and the latest version has added a 4GB
near default model v1-5-pruned-emaonly.safetensors
, which also needs to be downloaded, so just wait patiently.
If you want to speed up the download speed, you can download the model in advance, put it in models/Stable-diffusion
the folder , and then start it again webui-user.bat
, so that you will not download the model again
The default official download address of the model: https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main
If you feel that the official default download is slow, I also posted the download address of Baidu Cloud’s default model in the comment area, please choose by yourself
If the installation process goes well, open it directly in the browserhttp://127.0.0.1:7860
A successful visit means that the installation is successful, and the opened page is roughly as follows
2. Download the plug-in and localize it
Chinese installation
Way 1: Install from available
Click Extensions
the button , then click Available
the available extensions button, and finally click Load from
the button , it will be able to retrieve all available extensions from the index link behind for your own download
When the list of extensions is loaded, we search for the Bilingual Localization
language localization plug-in, and click to install
download it.
Way 2: Install from the website
Click first Extensions
, then click the third button belowInstall from URL
You need to manually fill in the Chinese link address for installation. Here we can github
choose the link or go to gitee
the link above in China.
The open source warehouse of the Sinicization plug-in is sd-webui-bilingual-localization
Or stable-diffusion-webui-chinese
, search for it, then paste the link in, and Install
click
https://github.com/VinsonLaro/stable-diffusion-webui-chinese.git
Way 3: Install from the website
-
We directly find
stable-diffusion-webui/extensions
the extension directory, then open a command line window and run the following command in that directory
git clone 仓库地址
Enable Sinicization
Method 1: Click Setting
the button , then click Bilingual Localization
the column on the left, and Localization file
select the language in the drop-down box
Method 2: Click Setting
the button , then click User interface
the bar on the left, and scroll down to the bottom to see the opening window Localizationg
of
After choosing, we need to click Apply setting
to save the configuration, and then click to Reload UI
reload the interface to play happily
Bilingual Sinicization
-
Bilingual Chinese warehouse link: https://github.com/journey-ad/sd-webui-bilingual-localization.git
-
The simple Sinicization above is just that the interface is fully converted to Chinese. If you want to display both Chinese and English, you need to use a bilingual plug-in
-
It is also through any of the above three methods to download the Chinese plug-in, you need to enable it to see the effect
-
At this time, we need
Setting
to setUser interface
the under the column on the left sideLocalizationg
ofNone
, andBilingual Localization
thenLocalization file
select the language in the drop-down box of the column, andUI
then restart
Use
Renderings:
Interface parameters
Before using Stable Diffusion
open source AI
painting, you need to understand the painting interface and the meaning of some parameters
At present, the effect of AI painting on Chinese prompt words is not good, try to use English prompt words
The most important parameters are as follows:
Prompt: Positive prompt words, that is tag
, the more prompt words, AI
the more accurate the drawing result will be
Negative prompt: Reverse prompt, that is, reversetag
Width / Height : The image size to be generated. The larger the size, the more performance and time-consuming it takes.
CFG scale: the degree ofAI
preference for the description parameters . Prompt
The smaller the value, the more the generated picture deviates from your description, but the more logical; the larger the value, the more consistent the generated picture is with your description, but it may not be logical.
Sampling method: Sampling method. There are many kinds, but there are only differences in the sampling algorithm, there is no good or bad, just choose the one that suits you.
Sampling steps: Sampling step size. If it is too small, the randomness of sampling will be very high, if it is too large, the sampling efficiency will be very low, and the probability of rejection will be high
Seed: random number seed. A random seed when generating each image, this seed is used as the basis for determining the initial state of the diffusion. If you don't understand, just use random
Restore faces: face repair, optimize the face, the principle is to call a neural network model to repair the face and affect the face. Repair the face of the character in the picture, but if the face repair is turned on for a non-realistic character, the face may collapse
Tiling: Seamless texture is an old-fashioned optimization technology, that is, the matrix multiplication optimization CUDA
of , which affects the drawing speed and reduces video memory consumption, but after actually selecting it, the normal picture may not even come out. can't beat
Highres.fix: High resolution fix, by default Vincent diagrams produce very chaotic images at high resolutions. If you use high-definition repair, it will first generate a picture according to the specified size, and then expand the resolution of the picture through the enlargement algorithm to achieve the effect of high-definition large picture
Sampler
Euler a: It is an illustration, tag
the utilization rate is second only to DPM2
and DPM2 a
, the ambient light effect is good, and the composition is sometimes weird
Euler: Soft, also suitable for illustrations, good environment detail and rendering, deep background blur
Heun: The average quality ratio of a single Euler
unearthed Euler a
is higher than and , but the speed is the slowest, and the high step
performance is good
DDIM: Suitable for wide images, low speed, high step
performance is good, tag
if the negative is not enough, it can play casually, the effect of ambient light and water vapor is good, and the realism is not good
DPM2: This sampling method tag
has the 80%
highest utilization rate of
DPM2 a: Almost the DPM2
same as , but there may be close-ups when the characters are
PLMS: The quality of a single drawing is second only toHeun
LMS: Texture OA
, saturation and contrast are low, more animation style
LMS Karras: It will be greatly changed to an optimized style, and the realism is not good
DPM fast: This is a test tool left by the developers of the upper world, not suitable for use by magicians
Vincent diagram (txt2img)
Vincent image (text2img): Generate corresponding images according to the description Prompt
of
Select 绘画模型(Stable Diffusion checkpoint)
► 文生图(txt2img)
► 填写正向提示词(Prompt)
► 填写反向提示词(Negative prompt)
► 选择采样器(一般选择DPM++ 2M Karras)
► 设置采样步骤(一般设置30)
► 设置长宽(Width / Height,推荐 1024 * 1536)
►点击生成(Generate)
According to the above steps, the picture can be generated from the text. Generally, we only Prompt
need to , Negative prompt
which is usually fixed, and limit the watermark, low quality and other possible logic errors.
Image generated image (img2img)
Image-generated image (img2img): generate another new image from an image based on the characteristics Prompt
described
Select 绘画模型(Stable Diffusion checkpoint)
► 图生图(img2img)
► 填写正向提示词(Prompt)
► 填写反向提示词(Negative prompt)
► 选择采样器(一般选择DPM++ 2M Karras)
► 设置采样步骤(一般设置30)
► 设置长宽(Width / Height,推荐 1024 * 1536)
►点击生成(Generate)
Upload a picture to Tushengtu and test it. Here we use the photo of Wenshengtu just now. According to the above steps, click Generate to see the effect
It can be seen that AI
the picture generated by the picture is actually based on the picture you uploaded and yours to Prompt
generate a photo similar to the one you uploaded
label weight
When entering Prompt
tags , sometimes you will write whatever you think of, and the weight written in the front will be the highest by default
stable Diffusion
You can also increase the weight of keywords through specific symbols in
where ()
is to strengthen the weight, []
is to reduce the weight, is{}
the "implementation" of for embeddingNAI
()
<>
For example: (eye) > [eye]
, (eye:1.4)
will add approx. more than normal 40%
, (eye:0.6)
will decrease approx.40 %
Model download
Model website recommendation: https://civitai.com/
The drop-down box in the upper left corner can be used to select the model, where v1-5-pruned-emaonly.safetensors
is the default model
The picture drawn by the default model is ugly, so we need to download a better and more suitable model to draw
Each model focuses on different styles of painting. Some are suitable for drawing people, some are suitable for drawing animation, and some are suitable for drawing landscapes. Choose the model that suits your own painting style and download it according to your needs.
Download the model, put the model file into models/Stable-diffusion
the folder , reload UI
, and you can see
The general difference between the models
name | need | Effect | Remark |
---|---|---|---|
stable-diffusion (4GB emaonly model) | 2GB video memory to start | The drawing speed is 10s, and the maximum single output is 920×920 | suitable for drawing |
stable-diffusion (7GB full ema model) | 4GB video memory to start | With the weight of the last training, so it costs video memory | suitable for training |
waifu (Float 16 EMA model) | 2GB video memory start | The performance is close to stable, but the video memory usage is slightly higher | suitable for drawing |
waifu (Float 32 EMA model) | 2GB video memory start | The performance is close to stable, but the video memory usage is slightly higher | Suitable for drawing, the picture quality is actually not much different from 16 |
waifu (Float 32 Full model) | 4GB video memory starts | The performance is close to stable, but the video memory usage is slightly higher | Suitable for drawing or training |
waifu (Float 32 Full + Optimizer model) | 8GB video memory start | The performance is close to stable, but the video memory usage is slightly higher | suitable for training |
Naifu (4GB pruned model) | Minimum 8GB VRAM & 8GB VRAM | closer to the official | suitable for drawing |
Naifu (7GB latest model) | Minimum 8GB video memory (floating 10GB upwards) | closer to the official | Suitable for drawing or training |
- Note that the video memory here refers to the size of 512X512. Under the default configuration, the video memory that the software needs to occupy when outputting a picture. 2GB video memory starts, which means that the actual video memory of your computer graphics card must be at least 3GB (because the system desktop and browser display also need to occupy part of the video memory)
- By adding various "optimization" parameters, you can exchange for a reduction in video memory usage through a partial decrease in performance.
- Nafu model name description 1: animefull-final-pruned = full-latest = NAI full model (including NSFW)
- Nafu model name description 2: animesfw-latest = NAI baseline model
References:
Stable Diffusion
Open source address: GitHub - AUTOMATIC1111/stable-diffusion-webui: Stable Diffusion web UI
Use of the latest version of Stable Diffusion open source AI painting tool
AI Tag Generator Geek Feitu AI Tag Generator