先在Ubuntu Server上裝好conda環境(顯卡環境也要裝好,GPU記憶體要夠)
我是用SSH連主機:
ssh 帳號@IP
再輸入密碼
1. 依賴項要先裝好
sudo apt install wget git python3 python3-venv
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
wget https://huggingface.co/hakurei/waifu-diffusion-v1-3/resolve/main/wd-v1-3-float32.ckpt
mv wd-v1-3-float32.ckpt stable-diffusion-webui/models/Stable-diffusion
其他Model可以參考https://cyberes.github.io/stable-diffusion-models/
conda create --name python3_10_6 python=3.10.6 -y && conda activate python3_10_6
5. 安裝套件環境(要先切到專案中)(以NVidia GPUs為範例)
cd stable-diffusion-webui
bash webui.sh
6. 安裝好後會直接在本地執行,可以Ctrl + C終止,然後使用python webui.py就可以執行了,再根據Command Line Arguments and Settings這篇加入或調整參數
以下為我的範例(開啟0.0.0.0監聽,使用8787 PORT,設置ui介面帳密登入),可供外網連線(需先確定PORT對外有開通)
python webui.py --listen --port=8787 --gradio-auth=jiunjiun:jiunjiun69
如果python webui.py會有套件安裝不正常的話(像是報ModuleNotFoundError: No module named 'fastapi'的錯誤),就換成用python launch.py執行,以下為我的範例:
python launch.py --listen --port=8787 --gradio-auth=jiunjiun:jiunjiun69
cd /路徑/stable-diffusion-webui
conda activate python3_10_6
python webui.py --listen --port=8787 --gradio-auth=jiunjiun:jiunjiun69
{{{masterpiece}}}, 1girl, {{nsfw}}
lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts,signature, watermark, username, blurry, artist name, bad feet