2023.05.30:
使用金字塔噪声,增加图像质量。
Applying "Diffusion With Offset Noise" to enhance image quality.
尝试加强腰部附着物的拟合程度,代价是没有头部的图像出现概率变大。
Attempting to improve the fit of waist attachments, at the cost of increased probability of images without heads.
如果出现没有头部的图像,请尝试在负面提示词添加
lower body
。If images without heads occur, please try adding 'lower body' to the negative prompt.
2023.04.22:
重新校对文本集,提示词的准确有所上升。
Reviewed the text dataset again, and the accuracy of prompt words has improved.
增加训练步数,提升拟合程度。
Increased the number of training steps to improve the fitting level.
2023.04.13:
这是我第一次进行LoRA训练,出现问题的地方我未必知道如何解决。
This is my first time training with LoRA, and there may be issues that I am not sure how to solve.
~~大就是好。~~
~~bigger is better.~~
?
Training Set:
number of repeats = 2
close-up = 10
portrait = 10
upper body = 10
lower_body=10
cowboy shot = 10
full body = 10
pose = 15
other clothing = 10
ornament_waist = 10
number of repeats = 4
nsfw = 30
chibi = 5
number of images = 130
number of epochs = 19
!/bin/bash
LoRA train script by @Akegarasu
Train data path | 设置训练用模型、图片
pretrainedmodel="./sd-models/model.ckpt" # base model path | 底模路径 isv2model=0 # SD2.0 model | SD2.0模型 2.0模型下 clipskip 默认无效 parameterization=0 # parameterization | 参数化 本参数需要和 V2 参数同步使用 实验性功能 traindatadir="./train/1.formidable-default" # train dataset path | 训练数据集路径 regdatadir="" # directory for regularization images | 正则化数据集路径,默认不使用正则化图像。
Network settings | 网络设置
networkmodule="networks.lora" # 在这里将会设置训练的网络种类,默认为 networks.lora 也就是 LoRA 训练。如果你想训练 LyCORIS(LoCon、LoHa) 等,则修改这个值为 lycoris.kohya networkweights="" # pretrained weights for LoRA network | 若需要从已有的 LoRA 模型上继续训练,请填写 LoRA 模型路径。 networkdim=32 # network dim | 常用 4~128,不是越大越好 networkalpha=16 # network alpha | 常用与 networkdim 相同的值或者采用较小的值,如 networkdim的一半 防止下溢。默认值为 1,使用较小的 alpha 需要提升学习率。
Train related params | 训练相关参数
resolution="768,768" # image resolution w,h. 图片分辨率,宽,高。支持非正方形,但必须是 64 倍数。 batchsize=2 # batch size maxtrainepoches=20 # max train epoches | 最大训练 epoch saveeverynepochs=1 # save every n epochs | 每 N 个 epoch 保存一次
trainunetonly=0 # train U-Net only | 仅训练 U-Net,开启这个会牺牲效果大幅减少显存使用。6G显存可以开启 traintextencoderonly=0 # train Text Encoder only | 仅训练 文本编码器 stoptextencodertraining=0 # stop text encoder training | 在第N步时停止训练文本编码器
噪音
noiseoffset="0" # noise offset | 在训练中添加噪声偏移来改良生成非常暗或者非常亮的图像,如果启用,推荐参数为0.1 keeptokens=2 # keep heading N tokens when shuffling caption tokens | 在随机打乱 tokens 时,保留前 N 个不变。 minsnrgamma=0 # minimum signal-to-noise ratio (SNR) value for gamma-ray | 伽马射线事件的最小信噪比(SNR)值 默认为 0
金字塔噪声
multiresnoiseiterations=6 # 多分辨率(金字塔)噪声迭代次数 推荐 6-10。无法与 noiseoffset 一同启用。 multiresnoisediscount=0.3 # 多分辨率(金字塔)衰减率 推荐 0.3,须同时与上方参数 multiresnoise_iterations 一同启用。
Learning rate | 学习率
lr="3.5e-5" # 3.5e-5=3.510^(-5)=0.000035 unetlr="3.5e-5" # 3.5e-5=3.510^(-5)=0.000035 textencoderlr="3e-6" # 3e-6=3.0*10^(-6)=0.000003 lrscheduler="cosinewithrestarts" # "linear", "cosine", "cosinewithrestarts", "polynomial", "constant", "constantwithwarmup", "adafactor" lrwarmupsteps=0 # warmup steps | 学习率预热步数,lrscheduler 为 constant 或 adafactor 时该值需要设为0。 lrrestartcycles=1 # cosinewithrestarts restart cycles | 余弦退火重启次数,仅在 lrscheduler 为 cosinewithrestarts 时起效。
Output settings | 输出设置
outputname="1.formidable-default" # output model name | 模型保存名称 savemodel_as="safetensors" # model save ext | 模型保存格式 ckpt, pt, safetensors
Resume training state | 恢复训练设置
savestate=0 # save state | 保存训练状态 名称类似于
-??????-state ?????? 表示 epoch 数 resume="" # resume from state | 从某个状态文件夹中恢复训练 需配合上方参数同时使用 由于规范文件限制 epoch 数和全局步数不会保存 即使恢复时它们也从 1 开始 与 network weights 的具体实现操作并不一致其他设置
minbucketreso=256 # arb min resolution | arb 最小分辨率 maxbucketreso=1024 # arb max resolution | arb 最大分辨率 persistentdataloaderworkers=0 # persistent dataloader workers | 容易爆内存,保留加载训练集的worker,减少每个 epoch 之间的停顿 clipskip=2 # clip skip | 玄学 一般用 2
优化器设置
optimizer_type="Lion" # Optimizer type | 优化器类型 默认为 AdamW8bit,可选:AdamW AdamW8bit Lion SGDNesterov SGDNesterov8bit DAdaptation AdaFactor
LyCORIS 训练设置
algo="lora" # LyCORIS network algo | LyCORIS 网络算法 可选 lora、loha、lokr、ia3、dylora。lora即为locon convdim=4 # conv dim | 类似于 networkdim,推荐为 4 convalpha=4 # conv alpha | 类似于 networkalpha,可以采用与 conv_dim 一致或者更小的值 dropout="0" # dropout | dropout 概率, 0 为不使用 dropout, 越大则 dropout 越多,推荐 0~0.5, LoHa/LoKr/(IA)^3暂时不支持
评论