Stable diffusion tutorial, detailed version, including solving various problems

premise:

need environment

git

git download addressGit - Downloading Package

 Just install it directly

python3.10.6

download link

Python Release Python 3.10.6 | Python.org

Remember that the python environment must be 3.10.6! ! !

first version

Project address https://github.com/AUTOMATIC1111/stable-diffusion-webui

Or use git to pull (if you don’t have git, git will also need to be downloaded)

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

The second version is one-click version

 https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases/tag/v1.0.0-pre

 download

 Then unzip it and enter the directory

Run update.bat,然后再跑run.batfirst, you may get a lot less errors, such as gpu, cuda, etc.

Install

Open the stable-diffusion-webui-master folder

Click on   the webui-user.bat   file

Wait for installation to complete

If there are no problems, just wait for the installation to complete and use

Open it in the browser and enter http://127.0.0.1:7860

 

 Normally, there would be no problem like this. I installed it on two computers, and one was fine immediately, while the other one had various problems.

Bug resolution

Torch is not able to use GPU

 If you don’t use GPU to run, you can directly open  the webui-user.bat   file and right-click to edit.

Then add  --lowvram --precision full --no-half --skip-torch-cuda-test  to solve the problem. This is the fastest solution, but the problem comes, the CPU is very slow to render the image. It takes at least 10 minutes to start. For GPU, it takes about 10 seconds with 1060 and about 3 seconds with 3060.

 This is another solution, using gpu to run

Download driver

Download the corresponding driver Official Advanced Driver Search | NVIDIA

 Choose according to your graphics card model

Then install it directly

Install CUDA

First check the versions supported by your computer

Open the desktop right click->nvidia control panel

 Then open system information

 Then

Then you can see that the currently supported version is version 11.4 

 What I have here is version 11.4, so I chose 11.4. You can choose according to your own situation.

Then install it the same way

When installing, select Advanced Installation

 

 

Then it is best to remember the installation path.

 Then install it.

Then check the environment variables

Click Settings-->Search for advanced system settings-->View environment variables

 Check to see if there are these 4 variables. If not, just add them manually.

Then win+r enter cmd, open the console, enter

nvcc --version

 

 This means the installation is successful

Then the problem is basically solved

 Then run webui-user.bat in stable-diffusion-webui-master at this time ( double-click it ), and the problem should be gone.

If something went wrong after opening the web page, Expecting value: line 1 column 1 (char 0)

Because it is occupied by other applications

Just exit this thing

Then there are the problems caused by various network problems. It is recommended to run over the wall. If you use domestic mirrors, you don’t need to go over the wall.

pip version error 

Just update pip 

Open the stable-diffusion-webui file

 

 

 Enter cmd and press Enter to open the console.

Then enter

python.exe -m pip install --upgrade pip

 After the update is completed, run the webui-user.bat ( double-click file

 See if there are any other errors reported

gfpgan installation failed

Go to stable-diffusion-webui-master\stable-diffusion-webui-master\venv\Scripts as above to open cmd and enter

git clone https://github.com/TencentARC/GFPGAN.git

When finished enter

//有可能不存在,但不影响
python.exe -m pip install basicsr facexlib
//有可能不存在,但不影响
python.exe -m pip install -r requirements.txt
python.exe -m pip install realesrgan

Then continue to run the webui-user.bat file

Failed to install clip

 Download clip code to local

git clone https://github.com/openai/CLIP.git

Find a place to put it and unzip it.

 Put it in stable -diffusion-webui-master\stable-diffusion-webui-master\venv\Scripts

Then go to the CLIP-main folder (stable-diffusion-webui-master\sd.webui\webui\venv\Scripts\CLIP-main) and enter cmd to open the console

 

Install dependencies

python.exe -m pip install ftfy regex tqdm
python.exe setup.py build install

Then after running, continue to run the webui-user.bat file

Installation of open_clip failed

Similarly, open the stable-diffusion-webui-master\stable-diffusion-webui-master\venv\Scripts folder

Enter cmd to open the console

python.exe -m pip install open_clip_torch

Then after running, continue to run the webui-user.bat file

Then it's basically done.

Summarize

If it is not equipped with domestic resolution, it is recommended to enable global circumvention. Anyway, if the download fails, just switch between domestic and foreign countries repeatedly to see which download speed is faster. Another problem is file corruption. Sometimes the download is interrupted in the middle. Yes, the second time I entered it, it did not require downloading. In this case, you need to clear the cache and download again.

Open win+r to open cmd

enter

pip cache purge

Just run it again. If repeated errors occur, just run according to the above process. Whatever error is reported, fix it.

Then the ai model website

LiblibAI·Liblib AI - China's leading original AI model sharing community

Then, for descriptors, you can find them on this website. Each picture has a descriptor.

The large model can be placed in stable-diffusion-webui-master\sd.webui\webui\models\Stable-diffusion

 

 The lora model is placed in

\stable-diffusion-webui-master\sd.webui\webui\models\Lora can be the folder

It’s not easy to knock by hand. Point out wrong expectations

add another point

Downloading

stable-diffusion-stability-ai

taming-transformers

k-diffusion

CodeFormer

BLIP

There may be errors reported due to network reasons. Even if you circumvent the wall, the download will be too slow. As a solution, you can choose to download manually, or copy other people's packages and put them in stable-diffusion-webui\repositories \ Just download it. If you need to copy the folder, you can message me privately.

git download (you need to install git)

Download stable-diffusion-stability-ai

Go to stable-diffusion-webui\repositories\ and enter cmd

git clone https://github.com/Stability-AI/stablediffusion.git 

Download taming-transformers

git clone https://github.com/CompVis/taming-transformers.git

Download k-diffusion

git clone https://github.com/crowsonkb/k-diffusion.git

DownloadCodeFormer

git clone https://github.com/sczhou/CodeFormer.git

Download BLIP

git clone https://github.com/salesforce/BLIP.git

If an error is reported halfway through downloading, and then it can run again, but a RuntimeError: Couldn't clone Stable Diffusion appears in the browser

Note: This is caused by an error reported halfway through downloading. Although it can be entered, the functions inside lack dependency support, so an error will be reported. At this time, you need to delete thefiles under stable-diffusion-webui\repositories\ . If you forget which file it is,you can delete all the folders under stable-diffusion-webui\repositories\ , and then run the webui-user.bat file again and it will automatically download it, or download it manually, or directly copy someone else's stable-diffusion -Just go to the folder under webui\repositories\

Next article roop installation tutorial! Video, picture face swap!

Guess you like

Origin blog.csdn.net/xiaoxiongxia/article/details/132088860