Stable-Diffusion|window10安装GPU版本的 Stable-Diffusion-WebUI遇到的一些问题(一)

教程主要参考:
AI绘画第一步,安装Stable-Diffusion-WebUI全过程 !
Stable Diffusion WebUI使用手冊(正體中文)|Ivon的部落格

具体记录一下笔者除了按照上述教程,遇到坑的地方

文章目录

  • 1 git + PYTHON
  • 2 Nvidia设置
  • 3 stable-diffusion-webui 安装
    • 3.1 git 问题
    • 3.2 其他问题
    • 3.3 安装成功
  • 4 更新升级

1 git + PYTHON

python一定要3.10
如果不是,就新建一个conda环境

# 新建
conda create -n your_env_name python=3.10
# 激活
conda activate your_env_name

安装python库的时候可以用其他源:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

2 Nvidia设置

笔者之前设置过,跳过

3 stable-diffusion-webui 安装

此时需要从GITGHUB把sd-webui拉下来,地址:
https://github.com/AUTOMATIC1111/stable-diffusion-webui

cd stable-diffusion-webui
./webui-user.bat

3.1 git 问题

因为笔者自己家网络问题,GIT CLONE一直有问题,所以只能翻梯子自己下载

先找到项目下的这个仓库文件夹repositories(路径看我上文截图),然后你右击鼠标进入命令终端窗口。执行命令的路径一定不要错哦

依次执行如下命令:

  • (1)输入git clone https://github.com/Stability-AI/stablediffusion.git
  • (2)输入git clone https://github.com/CompVis/taming-transformers.git
  • (3)输入git clone https://github.com/crowsonkb/k-diffusion.git
  • (4)输入git clone https://github.com/sczhou/CodeFormer.git
    (5)输入git clone https://github.com/salesforce/BLIP.git

命令操作如下:

5个命令执行完后之后,在repositories文件中就会下载生成对应的5个资源包了,我们这时再去启动项目就不会再去下下载文件,接下来它就会顺利的启动完成了。

3.2 其他问题

一些问题可见:
AUTOMATIC1111的Stable Diffusion WebUI常遇到的錯誤訊息的解決方式

笔者贴几个笔者遇到过的:

RuntimeError: Couldn’t install torch.

幾個可能:

  • 確認Python版本為3.10.6,不可從微軟商店安裝。並確認是否有安裝最新GPU驅動(Nvidia需要額外安裝CUDA)。
  • 防毒軟體擋住。
  • 非Nvidia GPU用戶也可能遇到此錯誤,於webui-user.bat的COMMANDLINE_ARGS加入–skip-torch-cuda-test引數跳過檢測。
  • 你沒有獨顯,所以它不給跑。沒有獨顯請考慮用 Google Colab

127.0.0.1:7860拒絕連線

變數太多,提供幾個可能解決方案:

  • 請確認開啟網址前終端機是否還開著,並有顯示Running on Local URL : http://127.0.0.1:7860的字樣
  • 網址改用http://localhost:7860連線
  • 用記事本開啟C:\Windows\System32\drivers\etc\hosts,確認裡面有無127.0.0.1 localhost這一行。
    請確認電腦沒有執行其他伺服器的程式(如Microsoft IIS),導致佔用通訊埠。
  • 開啟終端機,執行ipconfig /flushdns指令刷新DNS紀錄
  • 暫時關閉防火牆

问题:


ERROR: Could not find a version that satisfies the requirement tb-nightly (from torchreid) (from versions: none)
ERROR: No matching distribution found for tb-nightly

1)临时更换为阿里源(推荐这种)

python -m pip install tb-nightly -i https://mirrors.aliyun.com/pypi/simple

2)换的全局源

python -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

3.3 安装成功

安装成功后,之后再次使用还是直接点击下面的文件,就可以了:

盗图贴一下:

4 更新升级

20231216
笔者最近准备更新之前版本的stable-diffusion,但是遇到了更多的坑;

@echo off

set PYTHON=E:\\anaconda3\\envs\\sd\\python.exe
set GIT=
set VENV_DIR=G:\\xxxx\\stable-diffusion-webui-1.7.0-RC\\venv
set 

call webui.bat

webui-user.bat文件设置的时候,python路径和venv_dir路径是两个,这里可以看到好像是Stable-Diffusion会备份一次python路径的内容,到venv_dir,所以如果是升级或者更新,此时venv_dir当中的就是旧内容,可以删除,不然会出现各种奇怪报错,比如

AssertionError: An object named 'ResNetArcFace' was already registered in 'arch' registry

还有git的问题
一直报错:

unable to access 'https://github.com/sczhou/CodeFormer.git/': Empty reply from server

或者:

fatal: unable to access 'https://github.com/TencentARC/GFPGAN.git/': Failed to connect to github.com port 443 after 21071 ms: Timed out
error: unable to read sha1 file of inputs/whole_imgs/10045.png (72032fb46f0fa222ce4c6cc357b7af6da08c7da6)

比如

github,Empty reply from server?

这种情况,网上教程又是一堆乱指挥,其实是笔者的VPN开着的问题。。关掉就可以

还有报错 tb-nightly

ERROR: Could not find a version that satisfies the requirement tb-nightly (from torchreid) (from versions: none)
ERROR: No matching distribution found for tb-nightly

可以使用

python -m pip install tb-nightly -i https://mirrors.aliyun.com/pypi/simple

但是有可能仍然有报错,这里就是牵扯到,python路径和venv_dir路径可能没有对齐,所以如果是更新版本,一定要删掉之前的venv_dir的内容,重新让新环境对齐
此时的处理方式,也可以到stable-diffusion-webui-1.7.0-RC\venv\Scripts下,执行python -m pip install tb-nightly命令

Torch的cpu/gpu版本问题

 Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
 

会有这种报错,其实就是要到webui-user.bat文件重新设置一下COMMANDLINE_ARGS

@echo off

set PYTHON=E:\\anaconda3\\envs\\sd\\python.exe
set GIT=
set VENV_DIR=G:\\xxx\\stable-diffusion-webui-1.7.0-RC\\venv
set COMMANDLINE_ARGS= --lowvram --precision full --no-half --skip-torch-cuda-test

call webui.bat

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
社会演员多的头像社会演员多普通用户
上一篇 2023年12月22日
下一篇 2023年12月22日

相关推荐