kneiff commited on
Commit
11e3a52
·
1 Parent(s): 85a279b

- z-image training

Browse files

- No sfw export for chroma

MANIFEST.knf.xlsx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dbea508609557d68236652ddb95f796eff2a13f6dab2665ecf5274613ea45c83
3
- size 14890902
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd8ff41cd69ca60b7ec86918c599e52a9be45d25f9ed71f3321e000a9770c3e4
3
+ size 14890787
configs/CHROMA.knf.yaml CHANGED
@@ -31,7 +31,7 @@ mappings:
31
  - "2-HEAD" # Face/head detail examples.
32
 
33
  # > Also export manifest rows marked sfw into an additional generated sfw subset.
34
- export_sfw_subset: true # < Add generated sfw subset from rows marked sfw.
35
 
36
  # ==============================================================
37
  # == Images
 
31
  - "2-HEAD" # Face/head detail examples.
32
 
33
  # > Also export manifest rows marked sfw into an additional generated sfw subset.
34
+ export_sfw_subset: false # < Add generated sfw subset from rows marked sfw.
35
 
36
  # ==============================================================
37
  # == Images
configs/CHROMA_BASE.knf.yaml CHANGED
@@ -31,7 +31,7 @@ mappings:
31
  - "2-HEAD" # Face/head detail examples.
32
 
33
  # > Also export manifest rows marked sfw into an additional generated sfw subset.
34
- export_sfw_subset: true # < Add generated sfw subset from rows marked sfw.
35
 
36
  # ==============================================================
37
  # == Images
 
31
  - "2-HEAD" # Face/head detail examples.
32
 
33
  # > Also export manifest rows marked sfw into an additional generated sfw subset.
34
+ export_sfw_subset: false # < Add generated sfw subset from rows marked sfw.
35
 
36
  # ==============================================================
37
  # == Images
configs/Z_IMAGE.knf.yaml ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ==============================================================
2
+ # == Directories
3
+ # ==============================================================
4
+
5
+
6
+ # > Dataset sync derives SOURCE/, MANIFEST.knf.xlsx, and HF/<config-id>/ from this filename.
7
+
8
+ # -- Map exported subset names to source subfolders in MANIFEST.knf.xlsx.
9
+ mappings:
10
+ # > Anchor identity examples get sampled at a lower probability below.
11
+ felkin_anchor:
12
+ - "0-ANCHOR" # Source folder for anchor identity images.
13
+ # > Explicit anatomy close-up subsets are kept separate for sampling control.
14
+ genitals:
15
+ - "6-DICK" # Source folder for exposed anatomy close-ups.
16
+ - "6-SHEATH" # Source folder for sheathed anatomy close-ups.
17
+ # > Complete Body
18
+ fullbody:
19
+ - "0-FULLBODY" # Full-body identity examples; also included in rest subset.
20
+ - "99-VERSION-LEANER" # Alternate leaner full-body examples.
21
+ # > General identity, body, face, hand, leg, tail, and leaner variant images.
22
+ body_details:
23
+ - "1-TORSO" # Torso detail examples.
24
+ - "3-HANDS" # Hand detail examples.
25
+ - "4-LEGS" # Leg/foot detail examples.
26
+ - "5-TAIL" # Tail detail examples.
27
+ fur:
28
+ - "7-FUR" # Fur texture crops for coat, mane, spots, paws, tail, and anatomy-adjacent texture.
29
+ head:
30
+ - "2-HEAD" # Face/head detail examples.
31
+ # > Focused fur-texture crops derived from high-resolution Rook sources.
32
+
33
+ # > Also export manifest rows marked sfw into an additional generated sfw subset.
34
+ export_sfw_subset: false # < Add generated sfw subset from rows marked sfw.
35
+
36
+ # ==============================================================
37
+ # == Images
38
+ # ==============================================================
39
+
40
+ # Export-time mirroring writes fixed extra image/caption pairs before
41
+ # SimpleTuner sees the dataset. flip_only keeps kneifftools from applying its
42
+ # own random crop, rotation, or color jitter.
43
+ augmentations:
44
+ mirrored_extra: true # Add one mirrored copy per selected source image.
45
+ mirrored_transform: flip_only # Exact horizontal mirror, no kneifftools crop/jitter.
46
+ seed: 12345 # Makes mirrored export naming deterministic.
47
+
48
+ # Export image area bounds before SimpleTuner sees the dataset. The upper bound
49
+ # preserves more source detail than Chroma while staying below roughly 1024x1024.
50
+ image_resize:
51
+ min_pixel_area: 512 # Upscale tiny images below roughly 512x512 area.
52
+ max_pixel_area: 1024 # Downscale large images above roughly 1024x1024 area.
53
+
54
+ # ==============================================================
55
+ # == Captions
56
+ # ==============================================================
57
+
58
+ # Controlled caption rendering context used by all generated sidecars.
59
+ caption:
60
+ subject_sex: male # Adds male subject wording to prose renderers.
61
+ add_domains_to_tags: false # Z-Image captions are natural prose, not domain-tag tails.
62
+
63
+ # Default caption sidecar layout for every exported subset.
64
+ caption_outputs:
65
+ mode: hybrid_txt # One .txt sidecar per image containing selected formats.
66
+ formats: [z-image] # Z-Image-profile single-line captions for FLUX.2 Klein training.
67
+ # tag_scope: supplemental # Ignored by Z-Image; default is supplemental.
68
+
69
+ # Optional per-subset caption output overrides. Keep commented unless a subset
70
+ # needs different caption files or formats.
71
+ # caption_outputs_overrides:
72
+ # felkin_anchor:
73
+ # mode: hybrid_txt
74
+ # formats: [Z-Image]
75
+ # genitals:
76
+ # mode: hybrid_txt
77
+ # formats: [Z-Image]
78
+ # fullbody:
79
+ # mode: hybrid_txt
80
+ # formats: [Z-Image]
81
+ # body_details:
82
+ # mode: hybrid_txt
83
+ # formats: [Z-Image]
84
+ # fur:
85
+ # mode: hybrid_txt
86
+ # formats: [Z-Image]
87
+ # sfw:
88
+ # mode: hybrid_txt
89
+ # formats: [Z-Image]
90
+
91
+ # ==============================================================
92
+ # == Publishing
93
+ # ==============================================================
94
+
95
+ publishing:
96
+ huggingface:
97
+ pretty_name: Ladybug Felkin # Human-readable dataset-card base title.
98
+ version: v1.0-z-image # Public dataset version label.
99
+ optimized_for_model: FLUX.2 Klein Base 4B # Rendered as [For FLUX.2 Klein Base 4B].
100
+ tags: [Z-Image, Z-Image-Base, lora, diffusion-training, image-captioning]
101
+ adult_content: true # Render the adult-content notice in README.md.
102
+
103
+ # ==============================================================
104
+ # == LoRA Training
105
+ # ==============================================================
106
+
107
+ training:
108
+ enabled: true # Enables kneifftools training artifact generation.
109
+ backend: simpletuner # Selects the SimpleTuner LoRA backend.
110
+
111
+ simpletuner:
112
+ # enabled: true # Optional backend-specific switch; defaults to enabled.
113
+
114
+ # -- Generated artifact filenames written into TRAINING/<config-id>_<run>.
115
+ config_filename: simpletuner-config.json # Top-level SimpleTuner config.
116
+ data_backend_filename: simpletuner-multidatabackend.json # Multi-databackend config.
117
+
118
+ # Generated cache/output directories. Relative paths resolve below TRAINING/<config-id>_<run>.
119
+ cache_root: .simpletuner-cache # Shared model, text, and VAE cache root.
120
+ output_dir: _simpletuner-output # Normal full-run checkpoint output dir.
121
+
122
+ # Subset-specific SimpleTuner dataloader overrides. Any key here is merged
123
+ # into the subset backend entry after the dataset defaults below.
124
+ subsets:
125
+ felkin_anchor:
126
+ probability: 1 # Sample anchor identity images less often.
127
+ resolution: 1024 # High-resolution identity anchors support 1024 area.
128
+ # minimum_image_size: 1024 # Avoid using weakly upscaled anchors.
129
+ crop: false # Preserve full source composition.
130
+ # repeats: 0 # Optional per-subset repeat count.
131
+ # disabled: false # Optional per-subset on/off switch.
132
+ fullbody:
133
+ probability: 8 # Sample full-body subset at high probability.
134
+ resolution: 1024 # Full-body images are the strongest high-res subset.
135
+ crop: false # Preserve full-body composition.
136
+ # repeats: 0
137
+ # disabled: false
138
+ body_details:
139
+ probability: 3 # Sample general detail subset at normal probability.
140
+ crop: false # Preserve detail framing; many samples are already close crops.
141
+ # repeats: 0
142
+ # disabled: false
143
+ fur:
144
+ probability: 1.0 # Give focused fur crops extra exposure without changing other subsets.
145
+ crop: false # Preserve texture crop intent; do not random-crop fur samples.
146
+ # repeats: 0
147
+ # disabled: false
148
+ head:
149
+ probability: 2 # Sample head/face details at extra exposure.
150
+ resolution: 1024 # Preserve detail in high-res head crops.
151
+ crop: false # Preserve detail framing; many samples are close crops.
152
+ genitals:
153
+ probability: 4 # Sample anatomy subset at normal probability.
154
+ crop: false # Preserve anatomy crop framing.
155
+ # repeats: 0
156
+ # disabled: false
157
+
158
+ # Dataset backend defaults copied into every image subset entry.
159
+ dataset:
160
+ type: local # SimpleTuner local filesystem backend.
161
+ dataset_type: image # Image dataset backend, not text embeds.
162
+ resolution: 1024 # Default target area edge for mixed-resolution subsets.
163
+ minimum_image_size: 512 # Keep smaller detail/anatomy crops after export upscaling.
164
+ maximum_image_size: 1024 # Upper bound for input image sizing.
165
+ target_downsample_size: 1024 # Downsample target for cache generation.
166
+ resolution_type: pixel_area # Area-based buckets, not smaller-edge resize.
167
+ caption_strategy: textfile # Read captions from exported .txt sidecars.
168
+ metadata_backend: discovery # Discover images/captions from directories.
169
+ crop: false # Disable SimpleTuner cropping for this Z-Image run.
170
+ crop_style: center # Inert while crop is false; avoids random-crop defaults.
171
+ crop_aspect: preserve # Preserve original aspect instead of square crop.
172
+ # repeats: 0 # Dataset-level repeat count; subset can override.
173
+ # disabled: false # Dataset-level backend switch.
174
+
175
+ # Optional shared text-embedding backend overrides. Commented keys show the
176
+ # kneifftools-owned defaults for the generated text_embeds backend.
177
+ # text_embeds:
178
+ # id: text-embeds # Backend id used by SimpleTuner.
179
+ # type: local # Store embeddings on local filesystem.
180
+ # dataset_type: text_embeds
181
+ # default: true # Marks this as the shared embedding backend.
182
+ # cache_dir: .simpletuner-cache/text # Override generated text cache dir.
183
+ # disabled: false
184
+
185
+ # Generate a SimpleTuner user_prompt_library JSON from MANIFEST.knf.xlsx.
186
+ validation_prompts:
187
+ enabled: true
188
+ filename: simpletuner-validation-prompts.json
189
+ from_prompt_pack:
190
+ prompts: rook-kaefer
191
+ caption_styles: [nlg]
192
+ uses: [training_validation]
193
+ from_manifest:
194
+ enabled: true
195
+ seed: 42
196
+ profile: z-image
197
+ activation_token: Rook_Kaefer
198
+ species_token: felkin
199
+ negative_control_species: wolf
200
+ exchanges:
201
+ - [erection, fully_sheathed]
202
+
203
+ # Model and LoRA settings merged into the top-level SimpleTuner config.
204
+ model:
205
+ model_type: lora # Train a LoRA adapter.
206
+ model_family: z_image
207
+ model_flavour: base # base is Undistilled
208
+ lora_rank: 64 # LoRA rank/capacity.
209
+ lora_alpha: 64 # LoRA alpha scaling.
210
+ lora_type: standard # Standard LoRA, not an alternate adapter type.
211
+ lora_format: comfyui # Ask SimpleTuner to save ComfyUI-style LoRA keys.
212
+
213
+ # Base FLUX.2 Klein asset. Klein models use the bundled Qwen3 text
214
+ # encoder, so no separate T5/text-encoder path is set here.
215
+ # !! We don't have the 16 bit
216
+ # pretrained_model_name_or_path: /mnt/wsl/comfyui-models/models/diffusion_models/Chroma/chroma_v10HD.safetensors
217
+
218
+ # Precision defaults for FLUX.2 Klein LoRA training.
219
+ base_model_precision: no_change
220
+ base_model_default_dtype: bf16
221
+ mixed_precision: bf16
222
+ # init_lora: /path/to/existing.safetensors # Optional LoRA resume/init weights.
223
+ # lycoris_config: /path/to/lycoris.json # Optional LyCORIS config path.
224
+
225
+
226
+ # == Curricular warmup
227
+ subset_warmup:
228
+ enabled: true
229
+ subsets: [genitals, fullbody, head]
230
+ steps: 800 # !! First steps of the total run are ONLY listed subsets!
231
+
232
+
233
+ # Full-run trainer config. trainer_testrun below overrides selected keys
234
+ # only when knf lora sync/train is called with --testrun.
235
+ trainer:
236
+ tracker_project_name: kneifftools-lora-training # Experiment tracker project.
237
+ tracker_run_name: ladybird-z_image-1 # Full-run tracker name.
238
+ hub_model_id: ladybird-z_image-1-lora # Optional Hub model id if push_to_hub is enabled.
239
+
240
+ optimizer: adamw_bf16 # BF16 AdamW optimizer.
241
+ learning_rate: 0.00008 # 1.2e-4; BFL recommends 8e-5 to 1e-4 for LoRA.
242
+ lr_scheduler: constant_with_warmup # Ramp up LR to avoid weird color biases.
243
+ lr_warmup_steps: 100
244
+ seed: 42 # Training seed.
245
+ gradient_checkpointing: true # Reduce VRAM by recomputing activations.
246
+ max_grad_norm: 0.1 # Clip gradients for stability. Simpletuner recommends 0.01 for z-image
247
+ grad_clip_method: norm # Clip by gradient norm.
248
+
249
+ train_batch_size: 4 # Per-device batch size; 32 GB VRAM should handle this first.
250
+ gradient_accumulation_steps: 1 # Keep optimizer steps direct when VRAM allows batch 2.
251
+ num_train_epochs: 0 # Step-based training; max_train_steps controls run length.
252
+ max_train_steps: 2600 # First full Z-Image character run.
253
+
254
+ caption_dropout_probability: 0.0 # Disable caption dropout; keep trigger behavior stable.
255
+ data_backend_sampling: auto-weighting # Auto-balance dataloader sampling based on subset probabilities and sizes.
256
+
257
+ # push_to_hub: false # Upload final artifacts to Hugging Face Hub.
258
+ # push_checkpoints_to_hub: false # Upload intermediate checkpoints.
259
+ checkpoints_total_limit: 5 # Keep latest 5 checkpoints.
260
+ checkpoint_step_interval: 200 # Save checkpoint every 200 steps.
261
+ validation_step_interval: 200 # Run validation every 200 steps.
262
+ validation_on_startup: false # Render baseline validation before training.
263
+ validation_prompt_library: false # Disable SimpleTuner built-in prompt library.
264
+ validation_disable_unconditional: true # Skip unconditional validation branch.
265
+ validation_resolution: 1024x1024 # Keep validation affordable for the first Z-Image run.
266
+ validation_num_inference_steps: 35 # Full-run validation sampling steps.
267
+ validation_guidance: 4.0 # Inference guidance used by validation.
268
+ validation_guidance_real: null # Remove Chroma default guidance-real from generated config.
269
+ validation_guidance_rescale: 0.0 # Guidance rescale; 0 disables rescale.
270
+ validation_seed: 42 # Deterministic validation seed.
271
+ num_eval_images: 1 # Images per validation prompt.
272
+
273
+ report_to: tensorboard # Write TensorBoard logs.
274
+ logging_dir: logs # TensorBoard log dir relative to TRAINING/<config-id>_<run>.
275
+
276
+ # Additional kneifftools-owned SimpleTuner defaults. Leave commented to
277
+ # use defaults from src/kneiff/training/lora/simpletuner.py.
278
+ # use_ema: false
279
+ # vae_batch_size: 1
280
+ # data_backend_sampling: uniform
281
+ # allow_dataset_oversubscription: true
282
+ # aspect_bucket_alignment: 64
283
+ # tokenizer_max_length: 512
284
+ # t5_padding: zero
285
+ # fully_unload_text_encoder: true
286
+ # offload_during_startup: true
287
+ # keep_vae_loaded: false
288
+ # resume_from_checkpoint: /path/to/checkpoint
289
+
290
+ # Short smoke-run overrides. These merge last only with --testrun.
291
+ trainer_testrun:
292
+ validation_on_startup: false
293
+ tracker_run_name: ladybird-f2k-1-testrun # Separate tracker/log name for smoke runs.
294
+ output_dir: _simpletuner-output-testrun # Keep smoke checkpoints away from full run.
295
+ max_train_steps: 12 # Tiny run to verify plumbing.
296
+ checkpoint_step_interval: 12 # Save at the end of the smoke run.
297
+ validation_step_interval: 12 # Validate at the end of the smoke run.
298
+ validation_num_inference_steps: 12 # Faster validation for smoke runs.