Lora train
提要
參數
訓練步長
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- Presets 是 Kohya-ss 所提供的現成的設定檔
- 選擇不同算法的lora(LoHa、LoKr適合訓練畫風且多概念)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 每次訓練圖片的張數,如果數字越大,速度也會越快,但是精細程度會越低並且硬體要求越高
- epoch就是總共需要訓練幾次(EX:總步數=圖片張數 * 重複次數 * epoch,建議1200~1500)
- 強制設定最大步數後停止
- 每批數量假設為10,每2個epochs保存,會如下圖依序產生五個模型(不需要等全部步數跑完即可先使用)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
學習率
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 默認建議0.0001,圖片集簡單學習率就需要低一點,因為他可能一下就學會,很快就會過擬合,也會跟訓練批次大小有關係,批次大小越大學習率就需要高一點(同時多張圖片較複雜)
- 圖片的尺寸
- 文本編碼器學習率建議為U-net學習率的1/2~1/10
- 沒填會直接填入第1項的學習率
ps: 文本編碼器(text encoder)和 U-Net (圖像分割等任務的卷積神經網絡結構)模型的學習率
優化器
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 調度器 - 比較不會影響訓練結果
- 絕大多數只會使用到2~3個,主要為AdamW8bit,也可以使用Google推出的Lion(最佳學習率比AdamW小10倍左右且在大的batchsize表現優秀),還有Prodigy(神童)可以無腦把學習率設定為1
網路維度
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 訓練複雜的物品或者三次元建議64、128,二次元畫風32、16、8,此大小會影響模型大小,另外維度過高導致學習太深(過擬合)
- 權重強度,越接近rank則lora對原模型權重影響越小,越接近0影響越大,建議rank數值的一半,也可以設定0
ps:下圖主要是針對二次元的參數,如果需要訓練三次元須往上增加一倍
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
結論
機器學期裡的複雜神經網路,大多數時候都是一個不可解釋的黑箱,即使是推薦的參數,在不同的訓練集裡面,發揮的效果也是天差地遠,所以需要反覆訓練跟測試。
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
相關文件
參考影片