当前位置: 代码网 > it编程>编程语言>Asp.net > windows11搭建 stable-diffusion-webui

windows11搭建 stable-diffusion-webui

2024年08月05日 Asp.net 我要评论
2024年5月22日23:46:57建议电脑配置电脑配置: Intel® Core™ Ultra 5 125H 1.20 GHz 32.0 GB (31.6 GB 可用)系统:windows111,安装 Anaconda下载:64-Bit Graphical Installer (904.4M)安装比较简单,一路ok,注意吧命令加入环境变量:创建适合 stable-diffusion-webui 目前需要 3.10.6。

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

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com