StableDiffusion本地部署

发布时间 2023-08-27 23:28:39作者: xTechFly

## StableDiffusion本地部署
安装git

stablediffusion
https://huggingface.co/runwayml/stable-diffusion-v1-5

webui stablediffusion
https://github.com/AUTOMATIC1111/stable-diffusion-webui

webui汉化
https://github.com/VinsonLaro/stable-diffusion-webui-chinese

## 插件安装
github上下载,点击右侧的绿色按钮,下载安装包,然后解压到*\stable-diffusion-webui\extensions\sd-webui-controlnet目录下即可。


### 问题
RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
set COMMANDLINE_ARGS=--skip-torch-cuda-test 忽略cuda版本检查

zip下载失败问题
gfpgan
https://codeload.github.com/TencentARC/GFPGAN/zip/8d2447a2d918f8eba5a4a01463fd48e45126a379
open_clip
https://codeload.github.com/openai/CLIP/zip/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1

tb-nightly安装失败
pip install tb-nightly -i https://mirrors.aliyun.com/pypi/simple


git clone https://github.com/Stability-AI/stablediffusion.git失败
手动下载 https://github.com/Stability-AI/stablediffusion.git


根据PyTorch官网匹配关系https://pytorch.org/, PyTorch版本不支持CUDA12.2, 需要降级为CUDA11.8
CUDA11.8下载地址:
https://developer.nvidia.cn/cuda-11-8-0-download-archive
重新安装CUDA版本和Cudnn后,安装PyTorch
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 -i https://mirrors.aliyun.com/pypi/simple