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