未来的门户网站,开发公司组织架构图模板,高端响应式网站,天门网站建设设计StableDiffusion本地部署
为了做这个事#xff0c;这是第5篇文章了#xff0c;可谓是做足了准备。开干#xff01;
强烈建议把我之前发的文章看一看#xff0c;不然你会有点迷迷糊糊的。
整体思路
捋一捋思路#xff1a; 下载三个东西#xff0c;webui#xff0c;py…StableDiffusion本地部署
为了做这个事这是第5篇文章了可谓是做足了准备。开干
强烈建议把我之前发的文章看一看不然你会有点迷迷糊糊的。
整体思路
捋一捋思路 下载三个东西webuipython和git。 webui根目录下放python和git文件夹。 切记加下来所有的安装都使用cmd窗口用相对路径安装。因为所有的依赖包都需要在python/Lib/site-packages中。我直接复制一个没有问题的行不行 装pytorch以及附属的cuda。装完后进行验证。 安装其他依赖在requirements-versions.txt中。切记有爆红的未下载的包不要错过。 安装xformerclip。 配置webui-user.bat文件。
实践 下载webui并解压下载pyhton和git在其他文件夹并复制到此处。 此目录下打开cmd 下载cudapytorch。 # 使用这个。后面几次就是换镜像源了速度快且检查也成功了。
.\python\python.exe -m pip install torch2.3.1 torchvision0.18.1 torchaudio2.3.1 -f https://mirror.sjtu.edu.cn/pytorch-wheels/cu118# 第四次换阿里云 太慢了
# -f 选项表示指定一个包含包文件的页面。
# 而不是使用--index-url/-i因为这些镜像不提供完整的索引服务
.\python\python.exe -m pip install torch2.3.1 torchvision0.18.1 torchaudio2.3.1 -f https://mirrors.aliyun.com/pytorch-wheels/cu118# 第三次 指定了版本但装下来还是cpu版本的
.\python\python.exe -m pip install torch2.3.1 torchvision0.18.1 torchaudio2.3.1 -i https://pypi.tuna.tsinghua.edu.cn/simple# 第二次使用镜像源需要指定所有包的版本
# 失败了 报错为没有找到torch2.3.1cu118
.\python\python.exe -m pip install torch2.3.1cu118 torchvision0.18.1cu118 torchaudio2.3.1cu118 -i https://pypi.tuna.tsinghua.edu.cn/simple# 第一次 就在pytorch官网命令后加了个-i
# 失败了 检测的时候是cpu版本的
.\python\python.exe -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 -i https://pypi.tuna.tsinghua.edu.cn/simple检查或检测。 .\python\python.exe
import torch
torch.__version__
touch.cuda.is_available()
exit()# 其他检查
torch.version.cuda # cuda版本
torch.backends.cudnn.version() # cudnn版本安装其他依赖 # 很慢但我运行后没动了。
# 可以用镜像试试
.\python\python.exe -m pip install -r requirements_versions.txt 安装xformers # 第二次 指定版本 这是我从秋叶大佬整合包里找到的版本
.\python\python.exe -m pip install xformers0.0.27
# 第一次这个要求torch2.4.0会卸载掉我已经安装好的torch
.\python\python.exe -m pip install -U xformers --index-url https://download.pytorch.org/whl/cu118-U 是 --upgrade 的简写形式其功能是对已安装的包进行升级操作。 配置webui-user.bat文件然后点击该文件运行 echo off
set PYTHON.\python\python.exe
set GIT.\Git\bin\git.exe
set VENV DIR.\python
set COMMANDLINE ARGS--xformers --no-gradio-queue --lowvram --precision full --no-half
call webui.bat报错提示没有下载CLIP。不管。重新运行一次提示No module named pip。 下载pip.\python\python.exe -m ensurepip然后再运行 报错fatal: not a git repository。点击~\Git\git-cmd.exe并运行git init。还是不行。根目录下cmd运行git init。 报错。安装CLIP。 RuntimeError: Couldnt determine assetss hash: 6f7db241d2f8ba7457bac5ca9753331f0c266917.
Command: .\Git\bin\git.exe -C D:\SD-test\stable-diffusion-webui-master\repositories\stable-diffusion-webui-assets rev-parse HEAD
Error code: 128
stdout: HEAD# 安装clip两条命令。第一条是依赖包
.\python\python.exe -m pip install ftfy regex tqdm
# 会更新torch为2.5.6.然后需要更新一下pip为2.5
.\python\python.exe -m pip install githttps://github.com/openai/CLIP.git -i https://pypi.tuna.tsinghua.edu.cn/simple运行。报错说cpu不可用。直接重新装一遍pytorch2.3.1 pip install ftfy regex tqdm
pip install githttps://github.com/openai/CLIP.git提示没有hash要是卸载掉用git代码拉过来。
写到最后面也确实是没有耐心写每个过程自己是怎么做的了直接写总结吧。
总结
最最重要的是必须要有一个非常好的魔法上网工具。一定一定一定需要这可以解决很多问题。
在下载了python和git之后一定要用git clone代码把webui拉过来不然一定会出现git 的问题。
使用.\python\python.exe -m下载所有的包包括xformersCLIP。
webui-user.txt的set COMMANDLINE_ARGS参数需要设置其他不用动。