教程主要參考:
AI繪畫(huà)第一步,安裝Stable-Diffusion-WebUI全過(guò)程 !
Stable Diffusion WebUI使用手冊(cè)(正體中文)|Ivon的部落格
具體記錄一下筆者除了按照上述教程,遇到坑的地方
1 git + PYTHON
python一定要3.10
如果不是,就新建一個(gè)conda環(huán)境
# 新建
conda create -n your_env_name python=3.10
# 激活
conda activate your_env_name
安裝python庫(kù)的時(shí)候可以用其他源:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
2 Nvidia設(shè)置
筆者之前設(shè)置過(guò),跳過(guò)
3 stable-diffusion-webui 安裝
此時(shí)需要從GITGHUB把sd-webui拉下來(lái),地址:
https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
./webui-user.bat
3.1 git 問(wèn)題
因?yàn)楣P者自己家網(wǎng)絡(luò)問(wèn)題,GIT CLONE一直有問(wèn)題,所以只能翻梯子自己下載
先找到項(xiàng)目下的這個(gè)倉(cāng)庫(kù)文件夾repositories(路徑看我上文截圖),然后你右擊鼠標(biāo)進(jìn)入命令終端窗口。執(zhí)行命令的路徑一定不要錯(cuò)哦
依次執(zhí)行如下命令:
- (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個(gè)命令執(zhí)行完后之后,在repositories文件中就會(huì)下載生成對(duì)應(yīng)的5個(gè)資源包了,我們這時(shí)再去啟動(dòng)項(xiàng)目就不會(huì)再去下下載文件,接下來(lái)它就會(huì)順利的啟動(dòng)完成了。
3.2 其他問(wèn)題
一些問(wèn)題可見(jiàn):
AUTOMATIC1111的Stable Diffusion WebUI常遇到的錯(cuò)誤訊息的解決方式
筆者貼幾個(gè)筆者遇到過(guò)的:
RuntimeError: Couldn’t install torch.
幾個(gè)可能:
- 確認(rèn)Python版本為3.10.6,不可從微軟商店安裝。並確認(rèn)是否有安裝最新GPU驅(qū)動(dòng)(Nvidia需要額外安裝CUDA)。
- 防毒軟體擋住。
- 非Nvidia GPU用戶也可能遇到此錯(cuò)誤,於webui-user.bat的COMMANDLINE_ARGS加入–skip-torch-cuda-test引數(shù)跳過(guò)檢測(cè)。
- 你沒(méi)有獨(dú)顯,所以它不給跑。沒(méi)有獨(dú)顯請(qǐng)考慮用 Google Colab
127.0.0.1:7860拒絕連線
變數(shù)太多,提供幾個(gè)可能解決方案:
- 請(qǐng)確認(rèn)開(kāi)啟網(wǎng)址前終端機(jī)是否還開(kāi)著,並有顯示Running on Local URL : http://127.0.0.1:7860的字樣
- 網(wǎng)址改用http://localhost:7860連線
- 用記事本開(kāi)啟C:\Windows\System32\drivers\etc\hosts,確認(rèn)裡面有無(wú)127.0.0.1 localhost這一行。
請(qǐng)確認(rèn)電腦沒(méi)有執(zhí)行其他伺服器的程式(如Microsoft IIS),導(dǎo)致佔(zhàn)用通訊埠。 - 開(kāi)啟終端機(jī),執(zhí)行ipconfig /flushdns指令刷新DNS紀(jì)錄
- 暫時(shí)關(guān)閉防火牆
問(wèn)題:
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)臨時(shí)更換為阿里源(推薦這種)
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 安裝成功
安裝成功后,之后再次使用還是直接點(diǎn)擊下面的文件,就可以了:
盜圖貼一下:
4 更新升級(jí)
20231216
筆者最近準(zhǔn)備更新之前版本的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
文件設(shè)置的時(shí)候,python
路徑和venv_dir
路徑是兩個(gè),這里可以看到好像是Stable-Diffusion會(huì)備份一次python路徑的內(nèi)容,到venv_dir
,所以如果是升級(jí)或者更新,此時(shí)venv_dir當(dāng)中的就是舊內(nèi)容,可以刪除,不然會(huì)出現(xiàn)各種奇怪報(bào)錯(cuò),比如
AssertionError: An object named 'ResNetArcFace' was already registered in 'arch' registry
還有g(shù)it的問(wèn)題
一直報(bào)錯(cuò):
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?
這種情況,網(wǎng)上教程又是一堆亂指揮,其實(shí)是筆者的VPN開(kāi)著的問(wèn)題。。關(guān)掉就可以
還有報(bào)錯(cuò) 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
但是有可能仍然有報(bào)錯(cuò),這里就是牽扯到,python
路徑和venv_dir
路徑可能沒(méi)有對(duì)齊,所以如果是更新版本,一定要?jiǎng)h掉之前的venv_dir的內(nèi)容,重新讓新環(huán)境對(duì)齊
此時(shí)的處理方式,也可以到stable-diffusion-webui-1.7.0-RC\venv\Scripts
下,執(zhí)行python -m pip install tb-nightly
命令
Torch的cpu/gpu版本問(wèn)題文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-581687.html
Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
會(huì)有這種報(bào)錯(cuò),其實(shí)就是要到webui-user.bat
文件重新設(shè)置一下COMMANDLINE_ARGS
:文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-581687.html
@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
到了這里,關(guān)于Stable-Diffusion|window10安裝GPU版本的 Stable-Diffusion-WebUI遇到的一些問(wèn)題(一)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!