windows11搭建 stable-diffusion-webui

2024年5月22日23:46:57

建议电脑配置

电脑配置: Intel® Core™ Ultra 5 125H 1.20 GHz 32.0 GB (31.6 GB 可用)

系统:windows11

注意:最好挂上外网,或者设置好访问github的dns,不然很可能失败

1,安装 Anaconda

https://www.anaconda.com/download/success

下载:64-Bit Graphical Installer (904.4M)

安装比较简单,一路ok,注意吧命令加入环境变量:

默认安装路劲: C:\ProgramData\anaconda3

把 这个三个路径加入环境变量:

复制代码
C:\ProgramData\anaconda3
C:\ProgramData\anaconda3\Scripts
C:\ProgramData\anaconda3\Library\bin

创建适合 stable-diffusion-webui 目前需要 3.10.6

在 Anaconda Powershell Prompt 执行
conda create -n webui python=3.10.6

如果无法切换可以先执行

复制代码
conda init
conda activate webui

如果怕网络慢可以

.condarc的文件加入镜像

复制代码
channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
default_python:

也可以切换其他镜像地址

pip设置国内镜像 文件地址:C:\Users\zx\AppData\Roaming\pip\pip.ini

复制代码
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

升级pip,特殊情况
D:\python\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip

克隆仓库代码
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui


python -V
查看版本是不是 3.10.6

如果是就运行
start .\webui-user.bat 或者 .\webui-user.bat

大概率失败,是因为网络问题
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to 
D:\python\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors

建议直接吧  https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors  放到迅雷里面下载,因为这个模型很大,大概4g,下载完成之后复制到 D:\python\stable-diffusion-webui\models\Stable-diffusion\

查看所有的python环境
conda env list

我的电脑会出现

Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx', memory monitor disabled

是因为电脑使用是Ultra 5系列的intel cpu,所以无法直接运行 stable-diffusion-webui

cuda是intel gpu不是一个阵营的

cuda是英伟达的

https://zhuanlan.zhihu.com/p/672373175

未来可能支持,现在处于预览版,需要OpenVINO的支持

https://github.com/openvinotoolkit/stable-diffusion-webui/wiki/Installation-on-Intel-Silicon

Stable Diffusion WebUI 支持(预览版)

Stable Diffusion WebUI 现在可以在英特尔 CPU 和 GPU(集成显卡和独立显卡)等硬件上运行,并带有英特尔®发行版 OpenVINO™ 工具套件。这是积极开发中的预览支持,我们积极欢迎社区的反馈和贡献。

重要提示

要在 Windows 上的 WebUI 中获得最佳性能,请使用以下步骤启动webui-user.bat:

以管理员身份启动命令提示符

cd 到 stable-diffusion-webui 目录

运行webui-user.bat

OpenVINO 加速脚本目前不支持某些功能:

雇用修复

其他自定义脚本

使用 OpenVINO 运行 WebUI 的说明:

OpenVINO 支持通过自定义脚本提供。自定义脚本使用 PyTorch 的 torch.compile 功能和 HuggingFace Diffusers 库来提高性能。以下是入门说明:

如果您熟悉 Automatic1111 工作流程,请使用 OpenVINOToolKit 中的此分支而不是 Automatic1111,并按照说明进行操作。或者,按照以下说明操作:

Linux操作系统

Make sure Python version is 3.10+

复制代码
python -m venv sd_env
source sd_env/bin/activate
git clone https://github.com/openvinotoolkit/stable-diffusion-webui.git
cd stable-diffusion-webui

export PYTORCH_TRACING_MODE=TORCHFX
export COMMANDLINE_ARGS="--skip-torch-cuda-test --precision full --no-half" 

# Launch the WebUI
./webui.sh

通过运行启动WebUI后,按照此处的说明使用OpenVINO自定义脚本./webui.sh

Windows

下载并安装 git 和 Python 3.10.6(勾选添加到 PATH)

复制代码
git clone https://github.com/openvinotoolkit/stable-diffusion-webui.git
cd stable-diffusion-webui
webui-user.bat

按照此处的说明使用 OpenVINO 自定义脚本

笔记:

上述步骤将创建一个虚拟环境,并将所需的软件包安装到此环境中。如果您想使用自己的虚拟环境来运行 Stable Diffusion WebUI,请将行更新为 in 和 files。VENV_DIR=VENV_DIR=-first-time-runner.battorch-install.ps1

PyTorch 在 Windows 上尚不正式支持 torch.compile。启动torch-install.bat将安装 PyTorch 并为 OpenVINO 后端启用 torch.compile。

启用公共访问

要启用公共访问,请将"--share --listen"参数添加到变量中(在 Windows 上,您可以通过更新文件来执行此操作)。COMMANLINE_ARGUMENTSwebui-user.bat

安装说明

安装 OpenVINO:

从 Pypi 安装:

支持 torch.compile 的 OpenVINO 现已在 OpenVINO 预发行软件包中提供预览版。使用命令安装最新的预发行软件包pip install --pre openvino

从源代码构建和安装:

OpenVINO 也可以使用此处提供的说明从源代码构建

已知问题

将采样方法更改为 DPM++ 或 Karras 方法会重新编译模型,因为它对图形进行了一些修改。建议排除任何性能测量的首次图像生成时间

Regular Stable Diffusion 2.1 目前在独立 GPU 上存在已知问题。请改用 Stable Diffusion 2.1-base 版本。

经过还是有问题,如果想玩模型还得是cuda,而且intel的这个版本落后很多个版本,更新也不是特别即时。

comfyui也有类似的问题。

经过测试,建议使用 秋葉aaaki制作的启动器,因为可以识别

IPEX GPU 0: Intel® Arc™ Graphics (14 GB)

使用https://github.com/Nuullll/intel-extension-for-pytorch

Torch 2.1.0 (IPEX AOT, Core Ultra)

但是比较难下载,whl包,因为启动器使用的是 sjtug/mirror的镜像,目前还没有同步这个包,启动器也没看到

哪里可以设置镜像地址

这个是 秋葉aaaki制作的启动器的更新地址

https://www.bilibili.com/read/cv31254871/?spm_id_from=333.999.0.0

已经提交了更新请求给sjtug/mirror,不知道什么时候可以更新

https://github.com/sjtug/mirror-requests/issues/364

相关推荐
我希望的一路生花3 天前
Nik Collection 6.2全新版Nik降噪锐化调色PS/LR插件
人工智能·计算机视觉·设计模式·stable diffusion·aigc
GetcharZp3 天前
玩转AI绘画,你只差一个节点式“魔法”工具——ComfyUI 保姆级入门指南
人工智能·stable diffusion
Seeklike5 天前
diffuxers学习--AutoPipeline
人工智能·python·stable diffusion·diffusers
游戏AI研究所6 天前
ComfyUI 里的 Prompt 插值器(prompt interpolation / text encoder 插值方式)的含义和作用!
人工智能·游戏·机器学习·stable diffusion·prompt·aigc
迈火8 天前
ComfyUI-3D-Pack:3D创作的AI神器
人工智能·gpt·3d·ai·stable diffusion·aigc·midjourney
Seeklike9 天前
diffusers学习--stable diffusion的管线解析
人工智能·stable diffusion·diffusers
马甲是掉不了一点的<.<10 天前
Stable Diffusion 环境配置详细指南
stable diffusion·环境配置
软件测试-阿涛10 天前
【AI绘画】Stable Diffusion webUI 常用功能使用技巧
人工智能·深度学习·计算机视觉·ai作画·stable diffusion
m0_6038887110 天前
Stable Diffusion Models are Secretly Good at Visual In-Context Learning
人工智能·ai·stable diffusion·论文速览
爱分享的飘哥23 天前
第三十七章:文生图的炼金术:Stable Diffusion完整工作流深度解析
人工智能·pytorch·stable diffusion·文生图·ai绘画·代码实战·cfg