Upload train_lora_flux_kontext_24gb.yaml
Browse files
Kontext_pixel_art/train_lora_flux_kontext_24gb.yaml
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
# 特别注意: 云端关闭镜像后会清除内容, 关闭前先把数据保存到本地, 或者自己存储镜像
|
| 4 |
+
# 特别注意: 云端关闭镜像后会清除内容, 关闭前先把数据保存到本地, 或者自己存储镜像
|
| 5 |
+
# 特别注意: 云端关闭镜像后会清除内容, 关闭前先把数据保存到本地, 或者自己存储镜像
|
| 6 |
+
# 特别注意: 云端关闭镜像后会清除内容, 关闭前先把数据保存到本地, 或者自己存储镜像
|
| 7 |
+
config:
|
| 8 |
+
name: "Kontext_pixel_art" # 你的Lora名称
|
| 9 |
+
process:
|
| 10 |
+
- type: sd_trainer
|
| 11 |
+
training_folder: output
|
| 12 |
+
# performance_log_every: 1000
|
| 13 |
+
device: cuda:0 #用哪张显卡训练, 默认单卡不要改
|
| 14 |
+
# trigger_word: "p3r5on" #触发词, 打标的时候没有写可以删掉前面的 # 号, 在双引号中自己输入
|
| 15 |
+
network:
|
| 16 |
+
type: lora
|
| 17 |
+
linear: 16
|
| 18 |
+
linear_alpha: 16 #跟学习率有关, 越低越难练(没做大数据测试, 欢迎数据反馈), 跟下面 lr 学习率成反相关
|
| 19 |
+
lokr_full_rank: true
|
| 20 |
+
lokr_factor: -1
|
| 21 |
+
network_kwargs:
|
| 22 |
+
ignore_if_contains: []
|
| 23 |
+
save:
|
| 24 |
+
dtype: bf16 # precision to save
|
| 25 |
+
save_every: 250 # 多少步保存一次模型
|
| 26 |
+
max_step_saves_to_keep: 4 # 只保留最新的几个模型
|
| 27 |
+
save_format: diffusers
|
| 28 |
+
push_to_hub: false
|
| 29 |
+
datasets:
|
| 30 |
+
- folder_path: "/root/style/img" # 原始数据路径, 仅支持jpg, jpeg, and png, 不需要打标文件
|
| 31 |
+
control_path: "/root/root/style/edit" # 训练数据路径, 仅支持jpg, jpeg, and png 需要打标txt文件, 例如"Let him hold a sword in his hand"
|
| 32 |
+
mask_path: null
|
| 33 |
+
mask_min_value: 0.1
|
| 34 |
+
default_caption: ''
|
| 35 |
+
caption_ext: "txt" # 数据集打标文件的格式
|
| 36 |
+
# num_repeates: 20
|
| 37 |
+
caption_dropout_rate: 0.05 # 随机删除千分之5的关键词
|
| 38 |
+
shuffle_tokens: false # 是否打乱提示词, 会降低触发词的强度, 同时增加其他关键词的稳定性
|
| 39 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 40 |
+
resolution: [ 512, 768] # 数据集图片尺寸, 多个用[512,1024,...] , 不改也没事, 好像会自动分, 数据集图片尺寸太大了可能会爆显存, 不建议超过1500
|
| 41 |
+
train:
|
| 42 |
+
lr: 1e-4 #学习率, 1e-4(0.0001)到6e-4(0.0006)之间, 根据数据集大小, 训练步数, 适当调整
|
| 43 |
+
batch_size: 1 # 并行训练数, 量力而行, 不怕爆显存可以调高
|
| 44 |
+
steps: 10000 # 训练步数, 推荐1000-4000之间, 根据数据集大小调整, 也可逐步加大训练, 比如先练2000, 看看效果, 不行再加再训练
|
| 45 |
+
gradient_accumulation_steps: 1
|
| 46 |
+
train_unet: true
|
| 47 |
+
train_text_encoder: false # probably won't work with flux
|
| 48 |
+
#content_or_style: balanced # content, style, balanced 类似于风格Lora还是人物Lora, content侧重于内容, style侧重于风格, balanced在两者之间平衡 (没做测试)
|
| 49 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 50 |
+
noise_scheduler: flowmatch # for training only
|
| 51 |
+
optimizer: adamw8bit
|
| 52 |
+
timestep_type: weighted
|
| 53 |
+
content_or_style: balanced
|
| 54 |
+
optimizer_params:
|
| 55 |
+
weight_decay: 0.0001
|
| 56 |
+
# lr_scheduler: polynomial
|
| 57 |
+
skip_first_sample: true #默认开始训练前会画一次图, 把前面 # 去掉就是不画图
|
| 58 |
+
unload_text_encoder: false
|
| 59 |
+
linear_timesteps: true
|
| 60 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on.
|
| 61 |
+
ema_config:
|
| 62 |
+
use_ema: true
|
| 63 |
+
ema_decay: 0.99
|
| 64 |
+
|
| 65 |
+
# will probably need this if gpu supports it for flux, other dtypes may not work correctly
|
| 66 |
+
dtype: bf16
|
| 67 |
+
diff_output_preservation: false
|
| 68 |
+
diff_output_preservation_multiplier: 1
|
| 69 |
+
diff_output_preservation_class: person
|
| 70 |
+
model:
|
| 71 |
+
# huggingface model name or path
|
| 72 |
+
name_or_path: /root/FLUX.1-Kontext-dev
|
| 73 |
+
arch: flux_kontext
|
| 74 |
+
is_flux: true
|
| 75 |
+
quantize: true # run 8bit mixed precision
|
| 76 |
+
quantize_te: true
|
| 77 |
+
model_kwargs: {}
|
| 78 |
+
low_vram: true # uncomment this if the GPU is connected to your monitors. It will use less vram to quantize, but is slower.
|
| 79 |
+
sample:
|
| 80 |
+
sampler: flowmatch # must match train.noise_scheduler
|
| 81 |
+
sample_every: 250 # 多少步测试一次图片, 建议和上面save_every相同
|
| 82 |
+
width: 1024
|
| 83 |
+
height: 1024
|
| 84 |
+
prompts:
|
| 85 |
+
# ⭐ 使用正确的----ctrl_img格式
|
| 86 |
+
- Convert the image to ChatGPT 4o style pixel art ----ctrl_img /root/style/sample/img1.jpg
|
| 87 |
+
- Convert the image to ChatGPT 4o style pixel art ----ctrl_img /root/style/sample/img2.jpg
|
| 88 |
+
- Convert the image to ChatGPT 4o style pixel art ----ctrl_img /root/style/sample/img3.jpg
|
| 89 |
+
neg: ''
|
| 90 |
+
seed: 42
|
| 91 |
+
walk_seed: true
|
| 92 |
+
guidance_scale: 4 #画图的CFG
|
| 93 |
+
sample_steps: 25 #画图的采样步数
|
| 94 |
+
num_frames: 1
|
| 95 |
+
fps: 1
|
| 96 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 97 |
+
meta:
|
| 98 |
+
name: "Kontext_pixel_art"
|
| 99 |
+
version: '1.0'
|