AMD顯卡Stable diffusion本地部署(Windows系統(tǒng)下,支持SDXL模型)

1、首先需要安裝python 3.10.6和git,這兩步目前網(wǎng)上很多教程。完成后使用
git clone從下面的地址下載webui模型,https://github.com/lshqqytiger/stable-diffusion-webui-directml.git
2、注釋掉如圖所示的六行代碼,

保存后手動(dòng)去repositories下使用git clone生成。
這里安裝好之后可以手動(dòng)復(fù)制.git文件,并用記事本修改路徑為對(duì)應(yīng)文件名。

3、手動(dòng)安裝gfpgan、clip、open_clip_torch;使用虛擬環(huán)境中的python直接采用pip install的方式來(lái)進(jìn)行安裝。

4、安裝好后啟動(dòng)webui-user.bat;(需要下載模型并放入models/Stable diffusion文件夾中才可以使用并進(jìn)行繪圖,雖然會(huì)出現(xiàn)一個(gè)報(bào)錯(cuò):code-former setup error)
報(bào)錯(cuò)原因是因?yàn)?/span>code-former中的basicSR版本為(1.3.2),而外部虛擬環(huán)境中的版本為1.4.2,可以通過(guò)下面的方法解決。(來(lái)源https://github.com/sczhou/CodeFormer/issues/194)
復(fù)制此路徑中的misc.py文件(repositories/CodeFormer/basicsr/utils/misc.py)并替換此misc.py文件(venv/lib/python3.10/site-packages/basicsr/utils/misc.py)
"stable-diffusion-webui-directml\modules\codeformer_model.py"中需要將"face_det"修改為:"face_detector"
5、如果觸發(fā)交互時(shí)產(chǎn)生Something went wrong Expecting value: line 1 column 1 (char 0)的紅色報(bào)錯(cuò)信息,可以在webui-user.bat文件中增加參數(shù):--no-gradio-queue。(來(lái)源:https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/9150)