物联网软件开发资讯 stable-diffusion-webui手动装配详备智商(以及报错处罚、踩坑)-CSDN博客

著述目次 假话stable-diffusion-webui系列AMD显卡请看这篇著述前发问题环境装配经由升级CUDA驱动装配CUDAToolKit装配cuDNN克隆模式地址装配Pytorch启动模式 题外话 假话stable-diffusion-webui系列

主要先容stable-diffusion-webui的 主题斥地、插件斥地 等内容,感兴致的一又友不错订阅下!

假话Stable-Diffusion-Webui-客制化主题(一) 假话Stable-Diffusion-Webui-客制化主题(二) 假话Stable-Diffusion-Webui-客制化主题(三)

app

不定时更新中...

前一区(01-12):上期该区开出3个奖号05、07、10,该区最近6期共开出14个奖号,表现较热,本期推荐该区奖号:05、11。

上期龙头开出0字头号码05,近10期龙头开出0字头号码10次,本期龙头优先考虑0字头号码,推荐04。

AMD显卡请看这篇著述

stable-diffusion-webui手动装配详备智商(AMD显卡)

前提

领先不提议去装配stable-diffusion-webui的一键装配包,既然学习就一次性把它学会。然后,最主要的是一键装配有以下问题: 1、装配包的中的torch版块与我方的CUDA版块不兼容,临了诚然不错初始尺度,然则根底不会激活GPU去加速渲染图形,导致渲染一副图形的速率极慢 2、stable-diffusion-webui提议的python版块是3.10,然则python3.10可能无法通过pip大约conda去下载某些CUDA版块对应的torch,导致临了尺度无法启动

问题

笔者在装配经由中遭遇的问题: CUDA版块是10.2,使用python3.10去下载torch包时恒久取法找到CUDA10.2对应的torch包,这个问题困扰了我一天,之后发现python3.10当今是不赈济cuda10.2版块的torch包的,不错通过 CUDA版块对应的torch去检讨,最终通过先升级显卡驱动(升级CUDA版块)再下载对应CUDA版块的CUDAToolKit,再下载CUDA版块对应的torch包即可。

环境

OS:Windows10 显卡类型:NVIDIA(英伟达) Python版块:3.10.6(必须为该版块) Git:必须

装配经由 升级CUDA驱动

笔者这里由于遭遇了以上所述问题,是以先要升级CUDA驱动,若是是更高版块的驱动不错跳过该智商。

需要凭据我方显卡类型去下载相应的驱动,win + x ->确立管制器 ->深入适配器

图片

然后去 CUDA驱动 填写对应的显卡信息后搜索显卡驱动

图片

笔者这里礼聘第一个驱动进行下载,下载之后是一个exe文献,平直按照智商装配即可,经由比拟肤浅不再赘述

图片

装配完成后检讨CUDA版块,笔者这里是11.4.176

图片

大约是使用高歌nvidia-smi检讨,不错看到CUDA版块是11.4,相应的驱动版块是472.84
PS C:\Users\samsung> nvidia-smi
Sat Apr  1 14:02:38 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 472.84       Driver Version: 472.84       CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ... WDDM  | 00000000:01:00.0 Off |                  N/A |
| N/A    0C    P8    N/A /  N/A |     75MiB /  4096MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     14052    C+G   ...IA GeForce Experience.exe    N/A      |
+-----------------------------------------------------------------------------+
装配CUDAToolKit

若是正本装过CUDA ToolKit请先卸载

CUDA ToolKit 找到CUDA驱动版块对应的CUDA ToolKit版块下载,由于笔者这里的CUDA驱动版块是472.84,是以CUDA ToolKit版块礼聘11.4.4,CUDA驱动版块与CUDA ToolKit对应关联

图片

图片

下载好之后是一个exe文献,cuda_11.4.4_472.50_windows.exe,不错看到名字中含有不错使用该CUDA ToolKit的最小CUDA驱动为472.50。装配很肤浅,这里不再赘述。

最终检讨CUDA的施行版块,nvcc --version

PS C:\Users\samsung> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_Oct_11_22:11:21_Pacific_Daylight_Time_2021
Cuda compilation tools, release 11.4, V11.4.152
Build cuda_11.4.r11.4/compiler.30521435_0
装配cuDNN

cuDNN版块 cuDNN是一个神经收集学习的加速库,因为stable-diffusion-webui中凭据一些模子进行文本生图时不错用该包加速渲染速率。找到与CUDA版块一直的cuDNN下载

图片

下载后将该压缩包解压,将内部的全部文献复制到CUDA装配的目次下,路劲为: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4

图片

注:不错看到诚然有同名文献夹,然则莫得同名文献,是以cuDNN的文献在复制到CUDA中时是不会请示要隐敝的情况,若是有,那么一定是那处出错了 克隆模式地址

stable-diffusion-webui

图片

克隆github模式自行查询,比拟肤浅不再赘述。若是由于收集的原因无法克隆,不错先将模式fork到 我方的 https://gitee.com/ 仓库(国内仓库拜谒较快),然后再克隆到腹地,顺次如下:

图片

图片

图片

此时 git clone https://… 去把模式克隆到腹地就行 装配Pytorch

笔者这里使用Anaconda装配了一个python3.10.6的杜撰环境,天然行家也不错不使用Anaconda,平直下载装配python3.10.6亦然不错的

pytorch 需要装配CUDA版块对应的Pytorch版块,若是不是使用Annconda,请使用pip install指示下载pytorch

图片

笔者这里本应该装配CUDA11.4对应的pytorch,然则pytorch官网中当今并莫得提供该版块,于是装配了CUDA11.3对应的pytorch版块,该版块不错在CUDA11.4中使用
# 创建一个python3.10.6的杜撰环境,物联网软件开发公司并定名为 sdui
(base) C:\Users\samsung>conda create -n sdui python==3.10.6

...

#激活创建的杜撰环境 sdui
(base) C:\Users\samsung>conda activate sdui
# 装配pytorch,恭候工夫取决于网速
(sdui) C:\Users\samsung>conda install pytorch torchvision torchaudio pytorch-cuda=11.3 -c pytorch -c nvidia

#测试torch是否装配成效
(sdui) C:\Users\samsung>python
Python 3.10.6 | packaged by conda-forge | (main, Oct 24 2022, 16:02:16) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
# true代表成效使用torch
True
启动模式

防御:若是不是使用Anaconda装配的杜撰python环境,那么领先需要双击 webui-user.bat初始后会在模式根目次下生成一个杜撰的python环境(其实是拷贝了系统如故装配的python版块到webui的指定目次),即\venv\Scripts\python.exe,后续装配的python依赖包齐是需要通过该杜撰python环境中的python高歌去下载的

(2023-06-12)近盼望多同学响应双击webui-user.bat装配时经由中会反复报错,其实大多半的诞妄是由于在装配经由中会去github拉去依赖包时超时而导致的,实质原因是弗成成功的拜谒github,于是不错给在需要去github拉去依赖的代码处加上代理地址:

(旧版块stable-diffusion-webui加代理):参加webui根目次下,剪辑launch.py,全局搜索https://github.com,然后在前边加上https://ghproxy.com/前缀,即最终形成了https://ghproxy.com/https://github.com,紧记保存!

(新版块stable-diffusion-webui加代理):若是要给新版块的sd加代理,那么和以上的面容不太一样了(2023-05-29): 需要参加到sd根目次下的modules文献夹,然后剪辑launch_utils.py

图片

这么装配经由应该会成功许多!
# 参加模式根目次,装配模式 requirements.txt 中条目的依赖。不错添加给pip大约conda添加国内镜像,这么不错加速下载速率。怎么添加镜像这里不再赘述。
(sdui) D:\AI\project\stable-diffusion-webui>python -m pip install -r requirements.txt
#启动模式
(sdui) D:\AI\project\stable-diffusion-webui>python launch.py
Python 3.10.6 | packaged by conda-forge | (main, Oct 24 2022, 16:02:16) [MSC v.1916 64 bit (AMD64)]
Commit hash: 22bcc7be428c94e9408f589966c2040187245d81
Installing clip
Installing open_clip
Traceback (most recent call last):
  File "D:\AI\project\stable-diffusion-webui\launch.py", line 355, in <module>
    prepare_environment()
  File "D:\AI\project\stable-diffusion-webui\launch.py", line 269, in prepare_environment
    run_pip(f"install {openclip_package}", "open_clip")
  File "D:\AI\project\stable-diffusion-webui\launch.py", line 129, in run_pip
    return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
  File "D:\AI\project\stable-diffusion-webui\launch.py", line 97, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install open_clip.
Command: "C:\Users\samsung\.conda\envs\sdui\python.exe" -m pip install git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b --prefer-binary
Error code: 1
stdout: Looking in indexes: https://mirrors.cloud.tencent.com/pypi/simple
Collecting git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b
  Cloning https://github.com/mlfoundations/open_clip.git (to revision bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b) to e:\temp\pip-req-build-godg7jm4

stderr:   Running command git clone --filter=blob:none --quiet https://github.com/mlfoundations/open_clip.git 'E:\temp\pip-req-build-godg7jm4'
  fatal: unable to access 'https://github.com/mlfoundations/open_clip.git/': OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
  error: subprocess-exited-with-error

  git clone --filter=blob:none --quiet https://github.com/mlfoundations/open_clip.git 'E:\temp\pip-req-build-godg7jm4' did not run successfully.
  exit code: 128

  See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

git clone --filter=blob:none --quiet https://github.com/mlfoundations/open_clip.git 'E:\temp\pip-req-build-godg7jm4' did not run successfully.
exit code: 128

See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

这里报错穷乏open_clip依赖,因为这个依赖包是从github上去拉去的,笔者这里由于收集不安谧,是以下载失败了。此时不错平直使用conda指示去下载,其实下载指示不错去以上报错中的open_clip的github地址检讨,不错看到施行装配的是open_clip_torch依赖

图片

(sdui) D:\AI\project\stable-diffusion-webui>python -m pip install open_clip_torch

此外,也不错平直去github仓库将open_clip的代码clone到腹地,然后参加open_clip模式根目次下施行相应指示去装配

(sdui) D:\AI\project\open_clip>python setup.py build install

问题处罚后再次回到模式根目次下启动模式

(sdui) D:\AI\project\stable-diffusion-webui>python launch.py
Python 3.10.6 | packaged by conda-forge | (main, Oct 24 2022, 16:02:16) [MSC v.1916 64 bit (AMD64)]
Commit hash: 22bcc7be428c94e9408f589966c2040187245d81
Cloning Stable Diffusion into D:\AI\project\stable-diffusion-webui\repositories\stable-diffusion-stability-ai...
Cloning Taming Transformers into D:\AI\project\stable-diffusion-webui\repositories\taming-transformers...
Traceback (most recent call last):
  File "D:\AI\project\stable-diffusion-webui\launch.py", line 355, in <module>
    prepare_environment()
  File "D:\AI\project\stable-diffusion-webui\launch.py", line 289, in prepare_environment
    git_clone(taming_transformers_repo, repo_dir('taming-transformers'), "Taming Transformers", taming_transformers_commit_hash)
  File "D:\AI\project\stable-diffusion-webui\launch.py", line 151, in git_clone
    run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}")
  File "D:\AI\project\stable-diffusion-webui\launch.py", line 97, in run
    raise RuntimeError(message)
RuntimeError: Couldn't clone Taming Transformers.
Command: "git" clone "https://github.com/CompVis/taming-transformers.git" "D:\AI\project\stable-diffusion-webui\repositories\taming-transformers"
Error code: 128
stdout: <empty>
stderr: Cloning into 'D:\AI\project\stable-diffusion-webui\repositories\taming-transformers'...
fatal: unable to access 'https://github.com/CompVis/taming-transformers.git/': Failed to connect to github.com port 443: Timed out

又报错了,通过输出不错看出,这一步会在模式根目次下生成一个repositories文献夹,然后会从github上克隆一些模式到该文献夹下,然则克隆https://github.com/CompVis/taming-transformers.git模式时超时报错了,是以又是收集的问题,咱们平直将该模式手动克隆到repositories文献夹下,然后参加taming-transformers目次下施行

(sdui) D:\AI\project\stable-diffusion-webui\repositories\taming-transformers>python setup.py build install

# 防御:这里有一个坑,若是不是使用Anaconda生成的杜撰python环境的话,而是平直装配的python环境的话,模式启动时会在模式根目次下生成一个杜撰的python环境,后续智商装配的python依赖包齐是通过该杜撰环境的python指示装配的,是以,此时应该参加到该杜撰python环境的目次下,使用该杜撰环境的python去施行 python setup.py build install 这么的指示。
杜撰环境python旅途:模式根目次\venv\Scripts\python.exe

大约多启动模式试几次,笔者这里再次启动模式后等了一会就不错了

(sdui) D:\AI\project\stable-diffusion-webui>python launch.py
Python 3.10.6 | packaged by conda-forge | (main, Oct 24 2022, 16:02:16) [MSC v.1916 64 bit (AMD64)]
Commit hash: 22bcc7be428c94e9408f589966c2040187245d81
Cloning Taming Transformers into D:\AI\project\stable-diffusion-webui\repositories\taming-transformers...
Cloning K-diffusion into D:\AI\project\stable-diffusion-webui\repositories\k-diffusion...
Cloning CodeFormer into D:\AI\project\stable-diffusion-webui\repositories\CodeFormer...
Cloning BLIP into D:\AI\project\stable-diffusion-webui\repositories\BLIP...
Installing requirements for CodeFormer
Installing requirements for Web UI
Launching Web UI with arguments:
No module 'xformers'. Proceeding without it.
==============================================================================
You are running torch 1.12.1.
The program is tested to work with torch 1.13.1.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to D:\AI\project\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors

100%|█████████████████████████████████████████████████████████████████████████████| 3.97G/3.97G [16:22<00:00, 4.34MB/s]
Calculating sha256 for D:\AI\project\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors: 6ce0161689b3853acaa03779ec93eafe75a02f4ced659bee03f50797806fa2fa
Loading weights [6ce0161689] from D:\AI\project\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors
Creating model from config: D:\AI\project\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying cross attention optimization (Doggettx).
Textual inversion embeddings loaded(0):
Model loaded in 32.4s (calculate hash: 19.4s, load weights from disk: 0.7s, create model: 1.3s, apply weights to model: 3.9s, apply half(): 1.7s, load VAE: 1.1s, move model to device: 1.3s, load textual inversion embeddings: 2.8s).
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 1079.2s (import torch: 8.3s, import gradio: 6.2s, import ldm: 4.3s, other imports: 11.4s, list extensions: 0.3s, list SD models: 1008.8s, setup codeformer: 0.8s, list builtin upscalers: 0.1s, load scripts: 4.7s, load SD checkpoint: 32.9s, create ui: 0.9s, gradio launch: 0.5s).

这一步经由比拟长,不错看到会下载一个3.79G的Stable-diffusion模子到项贪图models文献夹下。其实我以为这里代码是不错优化下的,若是用户事前如故单独下载好了相应的模子(因为之后在使用经由中咱们亦然不错手动导入模子到models文献夹下),那么不错总计平直放到models文献夹底下,无需再次下载,是以这里我以为不错四肢可选选项让用户在高歌行中交互:是否下载xxx模子。 到这里咱们就不错拜谒以上日记输出中的地址进行项贪图拜谒:http://127.0.0.1:7860

图片

此时不错看到python正在使用GPU,解释CUDA是起作用的。

图片

到这里就算是装配成效了,若是思要汉化,github也有相应的汉化包,读者可自行探索使用。对于软件的使用笔者亦然一个生手,行家有好的教程不错放在驳倒区通盘学习。

题外话

此外,思创建一个微信群行家通常学习。入群需要效劳轨则: 不容连接包括但不限于政事、色情、宗教类等积恶中华东说念主民共和司法律的音讯; 不容告白; 不容暗自加群友; 群友一切的亏欠由我方承担物联网软件开发资讯,应当晋升警惕,不要轻信他东说念主!!! 个东说念主微信:INYOURWORLDWITHME(加群备注:AI绘图)

本站仅提供存储就业,扫数内容均由用户发布,如发现存害或侵权内容,请点击举报。

下一篇:没有了

Powered by 物联网软件开发的公司 @2013-2022 RSS地图 HTML地图

Copyright Powered by站群系统 © 2013-2024 云迈科技 版权所有