alissonpereiraanjos

main_example.toml

Sep 8th, 2025
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.36 KB | None | 0 0
  1. # Output path for training runs. Each training run makes a new directory in here.
  2. output_dir = '/train/outputs'
  3.  
  4. # Dataset config file.
  5. dataset = '/train/diffusion-pipe/examples/dataset.toml'
  6. # You can have separate eval datasets. Give them a name for Tensorboard metrics.
  7. # eval_datasets = [
  8. # {name = 'something', config = 'path/to/eval_dataset.toml'},
  9. # ]
  10.  
  11. # training settings
  12.  
  13. # I usually set this to a really high value because I don't know how long I want to train.
  14. epochs = 1000
  15. # Maximum number of steps to train.
  16. #max_steps = 5000
  17. # Batch size of a single forward/backward pass for one GPU.
  18. micro_batch_size_per_gpu = 1
  19. # For mixed video / image training, you can have a different batch size for images.
  20. #image_micro_batch_size_per_gpu = 4
  21. # Pipeline parallelism degree. A single instance of the model is divided across this many GPUs.
  22. pipeline_stages = 1
  23. # Number of micro-batches sent through the pipeline for each training step.
  24. # If pipeline_stages > 1, a higher GAS means better GPU utilization due to smaller pipeline bubbles (where GPUs aren't overlapping computation).
  25. gradient_accumulation_steps = 1
  26. # Grad norm clipping.
  27. gradient_clipping = 1.0
  28. # Learning rate warmup.
  29. warmup_steps = 100
  30. # Force the learning rate to be this value, regardless of what the optimizer or anything else says.
  31. # Can be used to change learning rate even when resuming from checkpoint.
  32. #force_constant_lr = 1e-5
  33.  
  34. # Block swapping is supported for Wan, HunyuanVideo, Flux, and Chroma. This value controls the number
  35. # of blocks kept offloaded to RAM. Increasing it lowers VRAM use, but has a performance penalty. The
  36. # exactly performance penalty depends on the model and the type of training you are doing (e.g. images vs video).
  37. # Block swapping only works for LoRA training, and requires pipeline_stages=1.
  38. #blocks_to_swap = 20
  39.  
  40. # eval settings
  41.  
  42. eval_every_n_epochs = 1
  43. eval_before_first_step = true
  44. # Might want to set these lower for eval so that less images get dropped (eval dataset size is usually much smaller than training set).
  45. # Each size bucket of images/videos is rounded down to the nearest multiple of the global batch size, so higher global batch size means
  46. # more dropped images. Usually doesn't matter for training but the eval set is much smaller so it can matter.
  47. eval_micro_batch_size_per_gpu = 1
  48. # Batch size for images when doing mixed image / video training. Will be micro_batch_size_per_gpu if not set.
  49. #image_eval_micro_batch_size_per_gpu = 4
  50. eval_gradient_accumulation_steps = 1
  51. # If using block swap, you can disable it for eval. Eval uses less memory, so depending on block swapping amount you can maybe get away with
  52. # doing this, and then eval is much faster.
  53. #disable_block_swap_for_eval = true
  54.  
  55. # misc settings
  56.  
  57. # Probably want to set this a bit higher if you have a smaller dataset so you don't end up with a million saved models.
  58. save_every_n_epochs = 2
  59. # Can checkpoint the training state every n number of epochs or minutes. Set only one of these. You can resume from checkpoints using the --resume_from_checkpoint flag.
  60. #checkpoint_every_n_epochs = 1
  61. checkpoint_every_n_minutes = 120
  62. # Always set to true unless you have a huge amount of VRAM.
  63. # This can also be 'unsloth' to reduce VRAM even more, with a slight performance hit.
  64. activation_checkpointing = true
  65. # Use reentrant activation checkpointing method (set this in addition to `activation_checkpointing`). Might be required for some models
  66. # when using pipeline parallelism (pipeline_stages>1). Otherwise recommended to not use it.
  67. #reentrant_activation_checkpointing = true
  68.  
  69. # Controls how Deepspeed decides how to divide layers across GPUs. Probably don't change this.
  70. partition_method = 'parameters'
  71. # Alternatively you can use 'manual' in combination with partition_split, which specifies the split points for dividing
  72. # layers between GPUs. For example, with two GPUs, partition_split=[10] puts layers 0-9 on GPU 0, and the rest on GPU 1.
  73. # With three GPUs, partition_split=[10, 20] puts layers 0-9 on GPU 0, layers 10-19 on GPU 1, and the rest on GPU 2.
  74. # Length of partition_split must be pipeline_stages-1.
  75. #partition_split = [N]
  76.  
  77. # dtype for saving the LoRA or model, if different from training dtype
  78. save_dtype = 'bfloat16'
  79. # Batch size for caching latents and text embeddings. Increasing can lead to higher GPU utilization during caching phase but uses more memory.
  80. caching_batch_size = 1
  81.  
  82. # Number of parallel processes to use in map() calls when caching the dataset. Defaults to min(8, num_cpu_cores) if unset.
  83. # If you have a lot of cores and multiple GPUs, raising this can increase throughput of caching, but it may use more memory,
  84. # especially for video data.
  85. #map_num_proc = 32
  86.  
  87. # Use torch.compile on the model. Can speed up training throughput by a decent amount. Not tested on all models.
  88. #compile = true
  89.  
  90. # How often deepspeed logs to console.
  91. steps_per_print = 1
  92. # How to extract video clips for training from a single input video file.
  93. # The video file is first assigned to one of the configured frame buckets, but then we must extract one or more clips of exactly the right
  94. # number of frames for that bucket.
  95. # single_beginning: one clip starting at the beginning of the video
  96. # single_middle: one clip from the middle of the video (cutting off the start and end equally)
  97. # multiple_overlapping: extract the minimum number of clips to cover the full range of the video. They might overlap some.
  98. # default is single_beginning
  99. video_clip_mode = 'single_beginning'
  100.  
  101. # This is how you configure HunyuanVideo. Other models will be different. See docs/supported_models.md for
  102. # details on the configuration and options for each model.
  103. [model]
  104. type = 'qwen_image'
  105. diffusers_path = '/models'
  106. dtype = 'bfloat16'
  107. transformer_dtype = 'float8'
  108. timestep_sample_method = 'logit_normal'
  109.  
  110. # For models that support full fine tuning, simply delete or comment out the [adapter] table to FFT.
  111. [adapter]
  112. type = 'lora'
  113. rank = 256
  114. # Dtype for the LoRA weights you are training.
  115. dtype = 'bfloat16'
  116. # You can initialize the lora weights from a previously trained lora.
  117. #init_from_existing = '/data/diffusion_pipe_training_runs/something/epoch50'
  118. # Experimental. Can fuse LoRAs into the base weights before training. Right now only for Flux.
  119. #fuse_adapters = [
  120. # {path = '/data2/imagegen_models/loras/some_lora.safetensors', weight = 1.0}
  121. #]
  122.  
  123. [optimizer]
  124. # AdamW from the optimi library is a good default since it automatically uses Kahan summation when training bfloat16 weights.
  125. # Look at train.py for other options. You could also easily edit the file and add your own.
  126. type = 'adamw_optimi'
  127. lr = 2e-5
  128. betas = [0.9, 0.99]
  129. weight_decay = 0.01
  130. eps = 1e-8
  131.  
  132. # Can use this optimizer for a bit less memory usage.
  133. # [optimizer]
  134. # type = 'AdamW8bitKahan'
  135. # lr = 2e-5
  136. # betas = [0.9, 0.99]
  137. # weight_decay = 0.01
  138. # stabilize = false
  139.  
  140. # Automagic optimizer from AI-Toolkit.
  141. # In my experience, this gives slightly worse results than AdamW with a properly tuned LR, but you can try it.
  142.  
  143. # [optimizer]
  144. # type = 'automagic'
  145. # weight_decay = 0.01
  146.  
  147. # Any optimizer not explicitly supported will be dynamically loaded from the pytorch-optimizer library.
  148. # [optimizer]
  149. # type = 'Prodigy'
  150. # lr = 1
  151. # betas = [0.9, 0.99]
  152. # weight_decay = 0.01
  153.  
  154. [monitoring]
  155. # Set to true and fill in these fields to enable wandb
  156. enable_wandb = false
  157. wandb_api_key = ''
  158. wandb_tracker_name = ''
  159. wandb_run_name = ''
  160.  
Advertisement
Add Comment
Please, Sign In to add comment