作者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/cn.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