在Stable Diffusion本地部署中遇到的問題記錄

學(xué)藝不精,菜鳥一個,多是些菜鳥問題,記錄一下以備以后忘了。
1、安裝Git環(huán)境
? ? https://git-scm.com/download/win? 下載64-bit Git for Windows Setup安裝
2、Git Bsah stable-diffusion-webui包
? ? $ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
3、安裝報錯Pytorch:
? ? 報錯:Could not find a version that satisfies the requirement? xxx? (from versions: none)
? ? 原因:Pytorch最高支持到Python 3.10,當(dāng)前使用版本為3.11
? ? 重新安裝Python3.9
4、stable-diffusion-webui/webui-user.bat安裝仍然認(rèn)Py311路徑
? ? 刪除stable-diffusion-webui/venv并重新運(yùn)行webui-user.bat
5、提示git未添加到PATH系統(tǒng)環(huán)境變量
? ? 在此電腦>屬性>高級系統(tǒng)設(shè)置>高級>環(huán)境變量>PTAH中添加Git/bin完整路徑
6、提示Couldn't install gfpgan
? ? 確保python的版本是 Python 3.10.6 ,或檢查環(huán)境變量Path,保持Python 3.10.6在最上邊
? ? 刪除stable-diffusion-webui/venv并重新運(yùn)行webui-user.bat
? ? (由于網(wǎng)絡(luò)原因,需要多次嘗試,如嘗試不成功按照8方式處理)
7、提示Couldn't install clip
? ? (由于網(wǎng)絡(luò)原因,需要多次嘗試,如嘗試不成功按照8方式處理)
8、提示Couldn't install open_clip
? ? 8.1在stable-diffusion-webui\venv\Scripts中Shift+右鍵,選擇“在此處打開powershell窗口”,輸入 ./Activate.ps1
? ? //如果成功執(zhí)行,則命令行最左側(cè)出現(xiàn)“(venv)”,跳過下方排障繼續(xù);
? ? //如果執(zhí)行失敗,提示“無法加載文件 因為在此系統(tǒng)中禁止執(zhí)行腳本”,則
? ? ? ? //找到Windows PowerShell,以管理員身份運(yùn)行;
? ? ? ? //執(zhí)行set-ExecutionPolicy RemoteSigned,并輸入Y;
? ? ? ? //最后使用get-executionpolicy來查看是否更改成功,如為RomoteSigned則成功;
? ? 8.2利用其他源安裝open_clip,執(zhí)行pip install git+https://gitee.com/ufhy/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b --prefer-binary
? ? 8.3成功后退出Powershell并重新運(yùn)行webui-user.bat
? ? //gfpgan和clip可以按照此方法,在8.2步驟使用pip install gfpgan或pip install clip安裝
9、報錯:Cannot add middleware after an application has started
? ? 降級fastapi,把fastapi==0.90.0添加到requirements_versions.txt里面

基本上到這里就不會再在執(zhí)行webui-user.bat上出問題了,靜靜等待webui-user.bat跑完,繼續(xù)學(xué)習(xí)記錄問題。