python安装

官网:https://www.python.org/downloads/release/python-3106/

直接下载安装程序:https://www.python.org/ftp/python/3.10.6/python-3.10.6-amd64.exe

记得勾选加入环境变量

cuda安装

cmd 输入命令

$ nvidia-smi

CUDA Version: 12.0

表示需要安装12.0版本的cuda

下载地址:

https://developer.nvidia.com/cuda-12-0-0-download-archive

下载完安装即可。

此过程略微漫长...

git安装

https://git-scm.com/download/win

安装后建议给git配置了代理(否则很慢):

git config --global http.proxy "http://127.0.0.1:7890"

安装stable-diffusion-webui

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

下载并解压到D:\TempD\AIGC\Painting\stable-diffusion-webui-1.6.0,注意选择磁盘空间较大的。

建议在安装前升级pip。在程序目录终端输入

venv\Scripts\activate
python -m pip install --upgrade pip

然后运行webui-user.bat,会自动帮我们安装虚拟环境和依赖。

此过程略微漫长...

如遇到RuntimeError: Couldn’t determine Stable Diffusion’s hash: cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf.错误

解决方案:

在stable-diffusion-webui-1.6.0/repoitories 文件中打开终端 输入

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

并将下载的文件夹重命名成 stable-diffusion-stability-ai

运行后会提示没有ckpt模型,关掉终端进行下一步

下载novelai模型

https://cyberes.github.io/stable-diffusion-models/

迅雷下载:

magnet:?xt=urn:btih:5bde442da86265b670a3e5ea3163afad2c6f8ecc&dn=novelaileak&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2810%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=http%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce

注意这里可以先下载stableckpt/animefull-final-pruned/model.ckpt,其它的等这个文件下载后再挂着下载,不然很慢。

下载后放到D:\TempD\AIGC\Painting\stable-diffusion-webui-1.6.0\models\Stable-diffusion目录

再次运行webui-user.bat即可自动打开网站

安装中文插件

具体参考:https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN

启动插件后如果报错:

OSError: openai/clip-vit-large-patch14 does not appear to have a file named pytorch_model.bin but there is a file for TensorFlow weights. Use `from_tf=True` to load this model from those weights.

解决方法:

.py头部加上

from transformers import CLIPModel
 
model = CLIPModel.from_pretrained("openai/clip-vit-large-patch14", from_tf=True)

再次重启bat脚本即可。

如果遇到了该错误:

Expecting value: line 1 column 1 (char 0)" thrown, when I added

解决方法:

webui.bat加上

set SD_WEBUI_RESTART=tmp/restart
set ERROR_REPORTING=FALSE
set COMMANDLINE_ARGS=--no-gradio-queue 这句

重启即可。

发表评论