本地部署StableDiffusion WebUI

1. 参考:

How To Run Stable Diffusion 2.0 On Your Local PC — No Code Guide
https://luminous-mapusaurus-1aa.notion.site/Stable-Diffusion-ce61d77468644806ab03a780f670df51
stable-diffusion-webui 安装_w3cschool
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

2. 安装步骤

2.1 conda换源

为了让conda执行下载指令加速,需要对conda换源操作,即将源由国外原始源,改为国内源;
Windows 用户无法直接创建名为 .condarc 的文件,可先执行 conda config --set show_channel_urls yes 生成该文件之后再修改。
.condarc文件编辑如下:

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
ssl_verify: true

2.2 安装pytorch

注意如果需要pytorch, 还需要添加pytorch的镜像

$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

$ conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia
https://luminous-mapusaurus-1aa.notion.site/Stable-Diffusion-ce61d77468644806ab03a780f670df51

2.3 安装python 3.10.6虚拟开发环境

$conda create --name python3106_sd2 python=3.10.6
...
#
# To activate this environment, use
#
#     $ conda activate python3106_sd2
#
# To deactivate an active environment, use
#
#     $ conda deactivate

2.4 pip安装依赖库

$pip install -r requirements_versions.txt # 执行此条命令前,请检查你的剩余磁盘空间

2.5 执行批处理

.\webui-user.bat 

3. FAQ

3.1 got an unexpected keyword argument ‘personalization_config’

本地部署StableDiffusion WebUI_第1张图片

参考:
https://github.com/XavierXiao/Dreambooth-Stable-Diffusion/issues/92
[Fixed]
re-use pip install -e . work for me.

3.2 RuntimeError: CUDA out of memory. Tried to allocate 4.00 GiB (GPU 0; 12.00 GiB total capacity; 8.31 GiB already allocated; 1012.77 MiB free; 8.49 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

参考:
https://stackoverflow.com/questions/73747731/runtimeerror-cuda-out-of-memory-how-setting-max-split-size-mb
https://huggingface.co/spaces/stabilityai/stable-diffusion/discussions/21
[fixed]
try using --W 256 --H 256 as part your prompt.
本地部署StableDiffusion WebUI_第2张图片
本地部署StableDiffusion WebUI_第3张图片

3.3 AttributeError: module ‘signal’ has no attribute ‘SIGUSR1’

本地部署StableDiffusion WebUI_第4张图片

[fixed]
https://github.com/rinongal/textual_inversion/issues/12
本地部署StableDiffusion WebUI_第5张图片
本地部署StableDiffusion WebUI_第6张图片
本地部署StableDiffusion WebUI_第7张图片

7.4 NameError: name ‘trainer’ is not defined
本地部署StableDiffusion WebUI_第8张图片

参考:
https://github.com/rinongal/textual_inversion/issues/84

你可能感兴趣的:(AIGC,stable,diffusion,python,pytorch,AIGC)