閒聊

Stable Diffusion 安裝

  1. 下載安裝Python最新版,安裝過程中請注意要勾選「Add Python to PATH」
  2. 下載安裝 Git Standalone 版,依照軟體安裝說明依序操作即可
  3. 在電腦工作列搜尋「CMD」,打開「命令提示字元」應用程式
  4. 輸入「git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git」後,按下 Enter 鍵
  5. 下載完畢後執行webui-user.bat他就會開始跑了

可能的問題

Stable Diffusion 會需要用到pytorch ,你的電腦會需要安裝 pytorch https://pytorch.org/get-started/locally

請依照你的cuda版本來安裝,cuda版本可以執行nvidia-smi 來找到你現在顯卡安裝的cuda版本

如果安裝好上面的pytorch後可以測試是否成功

C:\Users\User>python
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>import torch
>>>torch.cuda.is_available()
True

出現true就是正確了。

但是如果跑webui-user.bat 還是會失敗,顯示

venv "C:\Users\User\Desktop\Stable Diffusion\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.10.1
Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2
Traceback (most recent call last):
File "C:\Users\User\Desktop\Stable Diffusion\stable-diffusion-webui\launch.py", line 48, in
main()
File "C:\Users\User\Desktop\Stable Diffusion\stable-diffusion-webui\launch.py", line 39, in main
prepare_environment()
File "C:\Users\User\Desktop\Stable Diffusion\stable-diffusion-webui\modules\launch_utils.py", line 387, in prepare_environment
raise RuntimeError(
RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
請按任意鍵繼續 . . .

有一種可能,就是你的Stable Diffusion虛擬環境內沒有pytorch

你要執行stable-diffusion-webui\venv\Scripts\ 目錄下的activate.bat

這時候他會幫你切換到虛擬環境下的cmd 然後再去安裝pytorch即可

如指令pip3 install torch torchvision torchaudio –index-url https://download.pytorch.org/whl/cu126

執行完畢後就可以去開啟webui.bat 這時候就會出現網頁http://127.0.0.1:7861/ 給你玩了

Be the First to comment.

Leave a Comment

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

(若看不到驗證碼,請重新整理網頁。)