Upload train_lora_kontext_sock_removal_v3.yaml
Browse files
config/train_lora_kontext_sock_removal_v3.yaml
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
job: extension
|
| 2 |
+
config:
|
| 3 |
+
name: Kontext_sock_removal_v3
|
| 4 |
+
process:
|
| 5 |
+
- type: sd_trainer
|
| 6 |
+
training_folder: output
|
| 7 |
+
device: cuda:0
|
| 8 |
+
trigger_word: "sock_removal" # 触发词
|
| 9 |
+
|
| 10 |
+
# 网络配置 - 采用效果好的设置
|
| 11 |
+
network:
|
| 12 |
+
type: lora
|
| 13 |
+
linear: 16
|
| 14 |
+
linear_alpha: 16
|
| 15 |
+
lokr_full_rank: true # ⭐ 从config.yaml学习
|
| 16 |
+
lokr_factor: -1 # ⭐ 从config.yaml学习
|
| 17 |
+
network_kwargs:
|
| 18 |
+
ignore_if_contains: []
|
| 19 |
+
|
| 20 |
+
# 保存设置 - 采用效果好的设置
|
| 21 |
+
save:
|
| 22 |
+
dtype: bf16 # ⭐ 使用bf16
|
| 23 |
+
save_every: 250
|
| 24 |
+
max_step_saves_to_keep: 4 # ⭐ 保留更多检查点
|
| 25 |
+
save_format: diffusers # ⭐ 保存为diffusers格式
|
| 26 |
+
push_to_hub: false
|
| 27 |
+
|
| 28 |
+
# 数据集配置
|
| 29 |
+
datasets:
|
| 30 |
+
- folder_path: data/kontext_leg/kontext_training/images # 目标图片(无袜)
|
| 31 |
+
control_path: data/kontext_leg/kontext_training/controls # 控制图片(有袜)
|
| 32 |
+
mask_path: null
|
| 33 |
+
mask_min_value: 0.1
|
| 34 |
+
default_caption: ''
|
| 35 |
+
caption_ext: txt
|
| 36 |
+
caption_dropout_rate: 0.05
|
| 37 |
+
shuffle_tokens: false
|
| 38 |
+
cache_latents_to_disk: true
|
| 39 |
+
resolution: # ⭐ 包含1024分辨率
|
| 40 |
+
- 512
|
| 41 |
+
- 768
|
| 42 |
+
- 1024
|
| 43 |
+
|
| 44 |
+
# 训练参数 - 采用效果好的设置
|
| 45 |
+
train:
|
| 46 |
+
lr: 0.0001
|
| 47 |
+
batch_size: 1
|
| 48 |
+
steps: 3000 # ⭐ 增加到3000步
|
| 49 |
+
gradient_accumulation_steps: 1
|
| 50 |
+
train_unet: true
|
| 51 |
+
train_text_encoder: false
|
| 52 |
+
gradient_checkpointing: true
|
| 53 |
+
noise_scheduler: flowmatch
|
| 54 |
+
optimizer: adamw8bit
|
| 55 |
+
timestep_type: weighted
|
| 56 |
+
content_or_style: balanced
|
| 57 |
+
optimizer_params:
|
| 58 |
+
weight_decay: 0.0001
|
| 59 |
+
skip_first_sample: true
|
| 60 |
+
unload_text_encoder: false # ⭐ 从config.yaml学习
|
| 61 |
+
linear_timesteps: true # ⭐ 从config.yaml学习
|
| 62 |
+
ema_config: # ⭐ 添加EMA配置
|
| 63 |
+
use_ema: true
|
| 64 |
+
ema_decay: 0.99
|
| 65 |
+
dtype: bf16
|
| 66 |
+
diff_output_preservation: false # ⭐ 从config.yaml学习
|
| 67 |
+
diff_output_preservation_multiplier: 1
|
| 68 |
+
diff_output_preservation_class: person
|
| 69 |
+
seed: 42
|
| 70 |
+
|
| 71 |
+
# 模型配置 - 采用官方模型路径
|
| 72 |
+
model:
|
| 73 |
+
name_or_path: black-forest-labs/FLUX.1-Kontext-dev # ⭐ 使用官方路径
|
| 74 |
+
arch: flux_kontext
|
| 75 |
+
is_flux: true
|
| 76 |
+
quantize: true
|
| 77 |
+
quantize_te: true
|
| 78 |
+
model_kwargs: {}
|
| 79 |
+
low_vram: true # ⭐ 低显存优化
|
| 80 |
+
|
| 81 |
+
# 采样配置
|
| 82 |
+
sample:
|
| 83 |
+
sampler: flowmatch
|
| 84 |
+
sample_every: 250
|
| 85 |
+
width: 1024
|
| 86 |
+
height: 1024
|
| 87 |
+
prompts:
|
| 88 |
+
# ⭐ 使用正确的----ctrl_img格式
|
| 89 |
+
- Remove the socks from this woman ----ctrl_img data/kontext_leg/kontext_training/controls/sock_removal_001.jpg
|
| 90 |
+
- Remove stockings from the legs ----ctrl_img data/kontext_leg/kontext_training/controls/sock_removal_010.jpg
|
| 91 |
+
- Remove hosiery from this person ----ctrl_img data/kontext_leg/kontext_training/controls/sock_removal_020.jpg
|
| 92 |
+
neg: 'stockings, socks, pantyhose, tights, hosiery, bad anatomy, distorted'
|
| 93 |
+
seed: 42
|
| 94 |
+
walk_seed: true
|
| 95 |
+
guidance_scale: 4
|
| 96 |
+
sample_steps: 25
|
| 97 |
+
num_frames: 1
|
| 98 |
+
fps: 1
|
| 99 |
+
|
| 100 |
+
meta:
|
| 101 |
+
name: Kontext_sock_removal_v3
|
| 102 |
+
version: '1.0'
|