本文為部署在Colab上的Stable Diffusion 切模型簡單記錄.
當使用
https://github.com/camenduru/stable-diffusion-webui-colab
隨便部署一個比較新的模型版本.
這里我使用的是stable_diffusion_v2_1_webui_colab版本.
如果想要切換為其他模型,可以使用 CivitAi 和 Hugging Face 下載其他模型,然后切換.
1.使用CivitAi
打開CivitAi界面,在Search Term 中填入 ChilloutMix,Content Type選Checkpoint,,勾選Search by term,然后點擊Get List.
然后Model選擇ChilloutMix,version隨便選一個.
并且要注意選擇Model Filename,最后點擊 Download Model.
轉(zhuǎn)回colab界面,就會發(fā)現(xiàn),開始下載了.
跑完了顯示
models/Stable-diffusion/ChilloutMix/chilloutmix_.safetensors successfully downloaded.
下載完成后,刷新,選擇新下載的ChilloutMix
2.使用Hugging Face
C站上沒有的模型,進入 Hugging Face,通過命令行下載
Hugging Face這個界面下可以運行命令行.
例如,簡單運行命令行,查看配置.
nvidia-smi
然后可以下anything這個模型.
wget https://huggingface.co/ckpt/anything-v4.5-vae-swapped/resolve/main/anything-v4.5-vae-swapped.safetensors -O /content/stable-diffusion-webui/models/Stable-diffusion/anything-v4.5-vae-swapped.safetensors
下載完會顯示出來,然后就可以切換了.
3.簡單使用model + lora.
C站有好看的圖片,并提供了參數(shù),寫出了model和lora類型,還有prompt,可以直接生成.
https://civitai.com/gallery/248502?reviewId=41067&infinite=false&returnUrl=%2Fmodels%2F8029%2Felegant-hanfu-ruqun-style
Lora是小模型,必須搭配其他大模型.但是加入這個小模型,可以跑出漂亮的圖.
3.1 下載dalcefoPainting_3rd
找到dalcefoPainting_3rd 這個模型的下載地址
https://huggingface.co/liferecords/dalcefoPainting_3rd/tree/main
根據(jù)下載鏈接地址.https://huggingface.co/liferecords/dalcefoPainting_3rd/resolve/main/dalcefoPainting_3rd.safetensors
修改下wget 命令.具體如下.
wget https://huggingface.co/liferecords/dalcefoPainting_3rd/resolve/main/dalcefoPainting_3rd.safetensors -O /content/stable-diffusion-webui/models/Stable-diffusion/dalcefoPainting_3rd.safetensors
注意,改寫的時候,要用ASCII編碼.否則會報錯UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2970: ordinal not in range(128)
這里是復制到notepad中,但是默認是utf-8編碼,因此導致了這個問題.
導致刷新后,無法加載model,導致無法切換model.要是報錯了,就刪掉content目錄下的dalcefoPainting_3rd文件,再重新下載.
3.2 下載Lora并配置.
在CivitAi 界面的Search Term 填入 Elegant hanfu ruqun style 這個模型, Content Type選Lora,點擊Get List獲取模型,填充界面.
配置好其他,然后點擊下載.
colab中顯示下載成功.
extensions/sd-webui-additional-networks/models/lora/Elegant_hanfu_ruqun_style/elegantHanfuRuqun_v10.safetensors successfully downloaded.
然后配置Lora.
切到txt2img界面
找到Additional Networks,打開Enable.
點擊Refresh models,然后就可以選擇模型.這里選中剛剛下載的LoRA模型.
3.3 使用不同的模型試試效果
然后可以使用這些模型跑一跑,看看效果.anything和 dalcefoPainting 效果都還行.
最后插一句:煉丹太有意思啦.
參考鏈接:
【AI繪畫教程】通過Google Colab免費搭建Stable Diffusion環(huán)境 - 低配顯卡簿寂,云玩家福音骗奖,免費使用GPU計算資源, 詳解操作流程
不用買顯卡 也能跑Stable Diffusion?R瘃|Colab+Stable Diffusion 免費進行AI繪圖計算【stable-diffusion-webui-colab】
civitai
ai繪畫怎么能畫出好圖? - 轉(zhuǎn)不停的時鐘的回答 - 知乎