ComfyUI 輕鬆轉換不同 Style
有用過 Fooocus 的用家都會覺得可以隨意選擇風格很方便,不用每次自己設定 prompts,其實在 ComfyUI 也可以安裝 SDXL Prompt Styler 來實現。
安裝 SDXL Prompt Styler
- 在 ComfyUI 目錄打開 teriminal
- 進入
ComfyUI/custom_nodes
資料夾 - 用 git 下載文件
git clone https://github.com/twri/sdxl_prompt_styler.git
- 啟動/重新啟動 ComfyUI
GitHub - twri/sdxl_prompt_styler: Custom prompt styler node for SDXL in ComfyUI
Custom prompt styler node for SDXL in ComfyUI. Contribute to twri/sdxl_prompt_styler development by creating an account on GitHub.
使用方法
Add Node
>utils
>SDXL Prompt Styler
第一個方格是自訂的 prompt,第二個方格是自訂的 negative prompt,style 是選擇不同的風格 base 是沒有風格。也可以將 prompt 及 negative prompt 轉成經 node 輸入,右 click SDXL Prompt Styler,選擇 Convert text_positive to input 及 Convert text_negatice to input。
新增 Primitive Node
Add Node
>utils
>Primitive
將 Primitive Node 連到 text_positive input 就會變成 string,可輸入 prompt。
想使用以上 workflow 可以下載以下 file。
想了解更多風格可以參考這篇,我有為每一個風格生成參考圖。
簡易版 StableDiffusionWebUI - Fooocus
StableDiffusionWebUI 雖然功能強大,但更多人喜歡 Midjourney 單純用 prompt 的簡易操作方式。StableDiffusionWebUI 最具代表性的 extension - ControlNet 的作者 lllyasviel 重新構思 Stable Diffusion 後推出了這個新軟件 Fooocus。
自訂風格
如果有一些喜歡的風格 prompt 其實也可以在 SDXL Prompt Styler 中加入自訂風格,方便記錄及以後重用。
- 首先在
ComfyUI/custom_nodes/sdxl_prompt_styler/
資料夾中生增一個新的json
檔,我將此 file 命名為sdxl_styles_edmond.json。
- 然後依以上格式加入 prompt,
name
是在 node 中顯示的名稱,prompt
就是主要 prompt,當中的{prompt}
是指在 node input 的 prompt。negative_prompt
就是 negative prompt。 - 儲存後重啟 ComfyUI。
- 然後在 SDXL Prompt Styler 中就可以選擇新的 style 了。
總結
有 SDXL Prompt Styler 後可以更簡單生成不同風格的圖片,可以節省很多找風格 prompt 的時間。