作者mayasoo (mayasoo)
看板AI_Art
標題Re: [StaD] LORA差異訓練法
時間Sun Aug 20 09:27:57 2023
※ 引述《mayasoo (mayasoo)》之銘言:
: 這回連圖片都不用的練法
: 依據此工具進行訓練
: https://github.com/p1atdev/LECO
: 1. git clone https://github.com/p1atdev/LECO
: 2. 進入剛剛clone的目錄(應該是LECO)安裝一個虛擬機
: python -m venv venv
: 這將在專案目錄下創建一個名為 venv 的虛擬環境。
: 3. 然後啟用虛擬環境安裝必要的套件
: .\venv\Scripts\Activate
: pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
: pip install xformers
: pip install -r requirements.txt
: 3. 可以先跑一個測試的範例看看
: python ./train_lora.py --config_file "./examples/config.yaml"
: 訓練的所有設定都在兩個檔案一個config檔案一個prompt檔案
: 之後請把這兩個檔案改成你想要的就可以玩了
經過一週比較可以掌握這種方式了
4. 範例設定檔案,這是今天早上訓練的線畫comic lora,打字的時間正在訓練
所以還真的不知道效果
https://tinyurl.com/28jatvtn
https://www.dropbox.com/scl/fi/qx7ukmcwgcj1n1xphxba6/LECO.zip?rlkey=6hdgvebr2uza7m5b5wj6b65nl&dl=0
5. 0.ps1別管,那只是我懶得每次下comand,要用記得改使用的config檔案
example目錄底下兩個檔案是重點
6. config_linearts.yaml是設定檔案,嚴格來說除了存檔位置和檔名注意下
之外嚴格來說不用改,幾個小地方說明一下
pretrained_model是使用訓練的model設定我是用標準1.5不用改
network:
type: "c3lier" # "lierla" or "c3lier" 建議用c3lier
rank: 32 # 1~128 不建議太大
alpha: 16 # 習慣設定為rank一半
train的部分也寫好了
iterations: 1600 #步數1000~2000其實就夠了我習慣1600
其他部分注意存檔位置就沒啥好說了,這個檔案很簡單
--------------------------------------------------
7. linearts.yaml是重點
請參考範例
我舉兩段來說明
- target: "girl " # what word for erasing the positive concept from
positive: "photo,realism,photorealism, analog photo style, photo style,
film grain, hyperrealism, realistic,3d" # concept to erase
unconditional: "" # word to take the difference from the positive concept
neutral: "girl" # starting point for conditioning the target
action: "erase" # erase or enhance 增強或者消除
guidance_scale: 11#引導強度
resolution: 512
dynamic_resolution: true
batch_size: 1
- target: " girl" # what word for erasing the positive concept from
positive: "lineart, monochrome,black and white,bw,manga,manga style,
greyscale,colorless,Official art," # concept to erase
unconditional: "" # word to take the difference from the positive concept
neutral: "girl" # starting point for conditioning the target
action: "erase" # erase or enhance
guidance_scale: -11
resolution: 512
dynamic_resolution: true
batch_size: 1
# 以上這段其實蠻好懂得就是訓練標的是女孩,標的的prompt是positive,之前我有
# 負面詞彙unconditional但是後來發現效果不好就算了,中性詞彙我就簡單寫標的物girl
# action可以選增強或者刪除,我一律選刪除,配合下行的引導強度,如果是+值就是刪除
# 如果負值等於增強概念,強度11是我看別人的,預設1.2那個實在太低了......
# 所以上面兩段等於一段增加lineart漫畫的概念,一段減少照片實體的概念
# 然後如果你訓練標的是女孩是是不是只對女孩有效?不是的
是說打好字了範例還沒訓練好,等下訓練好了我再看看效果如何
https://civitai.com/models/131491?modelVersionId=144534
感覺微妙....
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.35.119.221 (臺灣)
※ 文章網址: https://webptt.com/m.aspx?n=bbs/AI_Art/M.1692494882.A.C88.html
※ 編輯: mayasoo (114.35.119.221 臺灣), 08/20/2023 09:58:51
※ 編輯: mayasoo (114.35.119.221 臺灣), 08/20/2023 11:18:03