天天看點

stable-diffusion-webui實操筆記之本地安裝

作者:小劉愛觀察

之前一直想使用stable-diffusion來制作一些圖檔,迫于之前的電腦是AMD的顯示卡,stable-diffusion不能很好的相容AMD的顯示卡。在由于2個月之後,前兩天終于下手了一款NVIDIA的顯示卡。考慮到stable-diffusion 的性能要求和自己囊中羞澀,入手了一款七彩虹的NVIDIA GeForce RTX 3060(12G)的顯示卡。

stable-diffusion-webui實操筆記之本地安裝

開箱!開箱!

stable-diffusion-webui實操筆記之本地安裝

手套、說明書

stable-diffusion-webui實操筆記之本地安裝

包裝盒

stable-diffusion-webui實操筆記之本地安裝

替換、更新

相比以前的迪蘭RX590(8G X戰神PLUS),RTX 3060更長一些,也更帥氣。安裝之後,立即使用魯大師測試了下,感覺不太對,才59000多分,之前的顯示卡都是200000萬分,經過和客服溝通才得知,需要到NVIDIA的官網去下載下傳對應型号的驅動。下面是安裝官網最新驅動之後的跑分。

stable-diffusion-webui實操筆記之本地安裝

硬體概覽

stable-diffusion-webui實操筆記之本地安裝

各項跑分

準備好硬體之後,下面就是安裝stable-diffusion的過程了。

步驟一、進入https://github.com/AUTOMATIC1111/stable-diffusion-webui,檢視官方安裝指南。

在windos有兩種方式安裝,我選擇了第二種。

stable-diffusion-webui實操筆記之本地安裝

1、git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

2、直接輕按兩下運作webui-user.bat檔案。

這裡需要注意幾點:

1、需要開啟科學上網。

2、由于某些原因,需要修改stable-diffusion-webui\modules\launch_utils.py檔案。

stable-diffusion-webui實操筆記之本地安裝

要修改的檔案

stable-diffusion-webui實操筆記之本地安裝

具體修改方式

xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.17')
    gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "https://ghproxy.com/https://github.com/TencentARC/GFPGAN/archive/8d2447a2d918f8eba5a4a01463fd48e45126a379.zip")
    clip_package = os.environ.get('CLIP_PACKAGE', "https://ghproxy.com/https://github.com/openai/CLIP/archive/d50d76daa670286dd6cacf3bcd80b5e4823fc8e1.zip")
    openclip_package = os.environ.get('OPENCLIP_PACKAGE', "https://ghproxy.com/https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip")

    stable_diffusion_repo = os.environ.get('STABLE_DIFFUSION_REPO', "https://ghproxy.com/https://github.com/Stability-AI/stablediffusion.git")
    taming_transformers_repo = os.environ.get('TAMING_TRANSFORMERS_REPO', "https://ghproxy.com/https://github.com/CompVis/taming-transformers.git")
    k_diffusion_repo = os.environ.get('K_DIFFUSION_REPO', 'https://ghproxy.com/https://github.com/crowsonkb/k-diffusion.git')
    codeformer_repo = os.environ.get('CODEFORMER_REPO', 'https://ghproxy.com/https://github.com/sczhou/CodeFormer.git')
    blip_repo = os.environ.get('BLIP_REPO', 'https://ghproxy.com/https://github.com/salesforce/BLIP.git')

    # stable_diffusion_commit_hash = os.environ.get('STABLE_DIFFUSION_COMMIT_HASH', "cf1d67a6fd5ea1aa600c4df58e5b47da45f6bdbf")
    # taming_transformers_commit_hash = os.environ.get('TAMING_TRANSFORMERS_COMMIT_HASH', "24268930bf1dce879235a7fddd0b2355b84d7ea6")
    # k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "c9fe758757e022f05ca5a53fa8fac28889e4f1cf")
    # codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
    # blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")


    stable_diffusion_commit_hash = ""
    taming_transformers_commit_hash = ""
    k_diffusion_commit_hash = ""
    codeformer_commit_hash =""
    blip_commit_hash = ""           

接下來就會在cmd視窗中打開:

stable-diffusion-webui實操筆記之本地安裝

注意标紅步驟可能會等待較長時間,别關閉視窗,隻是比較慢。出現以下視窗,表示已經運作 成功了,直接通路http://127.0.0.1:7860/即可。

stable-diffusion-webui實操筆記之本地安裝
stable-diffusion-webui實操筆記之本地安裝

運作成功之後的界面