StableDiffusion
How to install Stable Diffusion on Windows (AUTOMATIC1111)
Options
You can speed up Stable Diffusion with the --xformers option. If you have less than 8 GB VRAM on GPU, it is a good idea to turn on the --medvram option to save memory to generate more images at a time.
To enable them, right-click on the file webui-user.bat and select Edit. (You may need to select “Show More Options” first if you use Windows 11).
Replace the line
set COMMANDLINE_ARGS=
With
set COMMANDLINE_ARGS=--xformers --medvram
Save and close the file.
Embedding
什麼是embedding?
embedding,又名textual inversion,中文名“嵌入或文本反轉”。
在計算機科學中,embedding是將高維數據映射到低維空間的過程。在圖像處理中,embedding通常用於將圖像轉換為向量表示,以便進行機器學習和深度學習任務。在使用stable diffusion進行繪畫時,embedding可以用於將輸入的圖像轉換為向量表示,以便於算法對其進行處理和生成新的圖像。這種技術可以使算法更加高效地處理圖像數據,並提高生成圖像的質量和準確性。
如果你看不懂這段定義也沒關係,簡單講,可以把embedding理解為一種提前訓練好的模型,在模型處理的過程中,告訴模型要如何操作,比如embedding裡含有白髮的信息,那麼模型生成的所有圖像都會體現出白髮。
但正常操作時,只要提示詞足夠充分,嵌入式模型的意義不大,於是,“反向”使用它有了奇效。
比如,把畫壞的手的信息放到embedding裡,然後再填入到負面提示詞,這樣模型處理的時候,就不去生成embedding裡提示的壞手。
以我常用的badhandv4為例,不使用embedding,容易生成壞手,使用了embedding,出現壞手的機率就大大下降(也不是完全不出現)。
使用方式
將embedding文件下載,拷貝至根目錄下的embedding目錄裡,文件附檔名一般為pt或safetensors。
然後在文生圖的時候,負面提示詞裡輸入文件名即可(不需輸入擴展名)。 https://huggingface.co/embed
EasyNegative
EasyNegative: 包含了「單色背景」、「漸層背景」、「單調背景」、「書頁曲面般的背景」、「過黑」、「過暗」、「單調陰影」等,但會發現有「大小眼」的問題(在上圖右上人物,以及chilloutmix_Ni -Prompts EasyNegative左下人物較明顯,並且用在-Prompts時,較大的眼睛會從左眼變右眼)。
Pekora
Pekora的TIE把「強調上睫毛」、「黑色緊身衣/胸罩」和「胸形突出」等也算了進去,所以放在-Prompts時會有「上睫毛不明顯」、「變成超級平胸」且「排除黑色底的衣服」等現象。而放在+Prompts時,更能明顯注意到「強烈更改了畫風」。
AWS
Use ControlNet Canny and Prompt to change the style of scene
Prompt:
(masterpiece:1.4), (best quality), (highres),
temple in ruines, (midnight bliss), (moon:1.2), (star \(sky\)), (dark at night), torch, forest, stairs, columns, cinematic, detailed, atmospheric, epic, concept art, Matte painting, mist, photo-realistic, concept art, volumetric light, cinematic epic + rule of thirds octane render, corona render, movie concept art, octane render, cinematic, trending on artstation, movie concept art, cinematic composition, ultra-detailed, realistic, hyper- realistic,
Negative prompt:
(EasyNegative:1.4), (lowres), (low quality), (normal quality), watermark, car, cars on the street, human, sunlight,
Other Parameter:
Steps: 25, Sampler: Euler a, CFG scale: 6, Seed: xxxxxxxx, Size: 768x512, Model hash: xxxxxx
Resource
- AWS 生成式人工智慧 (GenAI) 示範工作坊
- 從頭開始學習Stable Diffusion:一個初學者指南
- 微調大型語言模型LLM的技術LoRA及生成式AI-Stable diffusion LoRA
- What are Model CheckPoint and LoRA in Stable Diffusion?