Upload folder using huggingface_hub
Browse files- .ipynb_checkpoints/mod_lora_scale-checkpoint.yaml +48 -0
- extract.example.yml +75 -0
- generate.example.yaml +60 -0
- mod_lora_scale.yaml +48 -0
- modal/modal_train_lora_flux_24gb.yaml +97 -0
- modal/modal_train_lora_flux_schnell_24gb.yaml +99 -0
- train_flex_redux.yaml +113 -0
- train_full_fine_tune_flex.yaml +108 -0
- train_full_fine_tune_lumina.yaml +100 -0
- train_lora_chroma_24gb.yaml +105 -0
- train_lora_flex2_24gb.yaml +166 -0
- train_lora_flex_24gb.yaml +102 -0
- train_lora_flux_24gb.yaml +97 -0
- train_lora_flux_kontext_24gb.yaml +107 -0
- train_lora_flux_schnell_24gb.yaml +99 -0
- train_lora_hidream_48.yaml +113 -0
- train_lora_lumina.yaml +97 -0
- train_lora_omnigen2_24gb.yaml +95 -0
- train_lora_qwen_image_24gb.yaml +96 -0
- train_lora_qwen_image_edit_2509_32gb.yaml +106 -0
- train_lora_qwen_image_edit_32gb.yaml +103 -0
- train_lora_sd35_large_24gb.yaml +98 -0
- train_lora_wan21_14b_24gb.yaml +102 -0
- train_lora_wan21_1b_24gb.yaml +91 -0
- train_lora_wan22_14b_24gb.yaml +112 -0
- train_slider.example.yml +230 -0
.ipynb_checkpoints/mod_lora_scale-checkpoint.yaml
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: mod
|
| 3 |
+
config:
|
| 4 |
+
name: name_of_your_model_v1
|
| 5 |
+
process:
|
| 6 |
+
- type: rescale_lora
|
| 7 |
+
# path to your current lora model
|
| 8 |
+
input_path: "/path/to/lora/lora.safetensors"
|
| 9 |
+
# output path for your new lora model, can be the same as input_path to replace
|
| 10 |
+
output_path: "/path/to/lora/output_lora_v1.safetensors"
|
| 11 |
+
# replaces meta with the meta below (plus minimum meta fields)
|
| 12 |
+
# if false, we will leave the meta alone except for updating hashes (sd-script hashes)
|
| 13 |
+
replace_meta: true
|
| 14 |
+
# how to adjust, we can scale the up_down weights or the alpha
|
| 15 |
+
# up_down is the default and probably the best, they will both net the same outputs
|
| 16 |
+
# would only affect rare NaN cases and maybe merging with old merge tools
|
| 17 |
+
scale_target: 'up_down'
|
| 18 |
+
# precision to save, fp16 is the default and standard
|
| 19 |
+
save_dtype: fp16
|
| 20 |
+
# current_weight is the ideal weight you use as a multiplier when using the lora
|
| 21 |
+
# IE in automatic1111 <lora:my_lora:6.0> the 6.0 is the current_weight
|
| 22 |
+
# you can do negatives here too if you want to flip the lora
|
| 23 |
+
current_weight: 6.0
|
| 24 |
+
# target_weight is the ideal weight you use as a multiplier when using the lora
|
| 25 |
+
# instead of the one above. IE in automatic1111 instead of using <lora:my_lora:6.0>
|
| 26 |
+
# we want to use <lora:my_lora:1.0> so 1.0 is the target_weight
|
| 27 |
+
target_weight: 1.0
|
| 28 |
+
|
| 29 |
+
# base model for the lora
|
| 30 |
+
# this is just used to add meta so automatic111 knows which model it is for
|
| 31 |
+
# assume v1.5 if these are not set
|
| 32 |
+
is_xl: false
|
| 33 |
+
is_v2: false
|
| 34 |
+
meta:
|
| 35 |
+
# this is only used if you set replace_meta to true above
|
| 36 |
+
name: "[name]" # [name] gets replaced with the name above
|
| 37 |
+
description: A short description of your lora
|
| 38 |
+
trigger_words:
|
| 39 |
+
- put
|
| 40 |
+
- trigger
|
| 41 |
+
- words
|
| 42 |
+
- here
|
| 43 |
+
version: '0.1'
|
| 44 |
+
creator:
|
| 45 |
+
name: Your Name
|
| 46 |
+
email: your@email.com
|
| 47 |
+
website: https://yourwebsite.com
|
| 48 |
+
any: All meta data above is arbitrary, it can be whatever you want.
|
extract.example.yml
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
# this is in yaml format. You can use json if you prefer
|
| 3 |
+
# I like both but yaml is easier to read and write
|
| 4 |
+
# plus it has comments which is nice for documentation
|
| 5 |
+
job: extract # tells the runner what to do
|
| 6 |
+
config:
|
| 7 |
+
# the name will be used to create a folder in the output folder
|
| 8 |
+
# it will also replace any [name] token in the rest of this config
|
| 9 |
+
name: name_of_your_model
|
| 10 |
+
# can be hugging face model, a .ckpt, or a .safetensors
|
| 11 |
+
base_model: "/path/to/base/model.safetensors"
|
| 12 |
+
# can be hugging face model, a .ckpt, or a .safetensors
|
| 13 |
+
extract_model: "/path/to/model/to/extract/trained.safetensors"
|
| 14 |
+
# we will create folder here with name above so. This will create /path/to/output/folder/name_of_your_model
|
| 15 |
+
output_folder: "/path/to/output/folder"
|
| 16 |
+
is_v2: false
|
| 17 |
+
dtype: fp16 # saved dtype
|
| 18 |
+
device: cpu # cpu, cuda:0, etc
|
| 19 |
+
|
| 20 |
+
# processes can be chained like this to run multiple in a row
|
| 21 |
+
# they must all use same models above, but great for testing different
|
| 22 |
+
# sizes and typed of extractions. It is much faster as we already have the models loaded
|
| 23 |
+
process:
|
| 24 |
+
# process 1
|
| 25 |
+
- type: locon # locon or lora (locon is lycoris)
|
| 26 |
+
filename: "[name]_64_32.safetensors" # will be put in output folder
|
| 27 |
+
dtype: fp16
|
| 28 |
+
mode: fixed
|
| 29 |
+
linear: 64
|
| 30 |
+
conv: 32
|
| 31 |
+
|
| 32 |
+
# process 2
|
| 33 |
+
- type: locon
|
| 34 |
+
output_path: "/absolute/path/for/this/output.safetensors" # can be absolute
|
| 35 |
+
mode: ratio
|
| 36 |
+
linear: 0.2
|
| 37 |
+
conv: 0.2
|
| 38 |
+
|
| 39 |
+
# process 3
|
| 40 |
+
- type: locon
|
| 41 |
+
filename: "[name]_ratio_02.safetensors"
|
| 42 |
+
mode: quantile
|
| 43 |
+
linear: 0.5
|
| 44 |
+
conv: 0.5
|
| 45 |
+
|
| 46 |
+
# process 4
|
| 47 |
+
- type: lora # traditional lora extraction (lierla) with linear layers only
|
| 48 |
+
filename: "[name]_4.safetensors"
|
| 49 |
+
mode: fixed # fixed, ratio, quantile supported for lora as well
|
| 50 |
+
linear: 4 # lora dim or rank
|
| 51 |
+
# no conv for lora
|
| 52 |
+
|
| 53 |
+
# process 5
|
| 54 |
+
- type: lora
|
| 55 |
+
filename: "[name]_q05.safetensors"
|
| 56 |
+
mode: quantile
|
| 57 |
+
linear: 0.5
|
| 58 |
+
|
| 59 |
+
# you can put any information you want here, and it will be saved in the model
|
| 60 |
+
# the below is an example. I recommend doing trigger words at a minimum
|
| 61 |
+
# in the metadata. The software will include this plus some other information
|
| 62 |
+
meta:
|
| 63 |
+
name: "[name]" # [name] gets replaced with the name above
|
| 64 |
+
description: A short description of your model
|
| 65 |
+
trigger_words:
|
| 66 |
+
- put
|
| 67 |
+
- trigger
|
| 68 |
+
- words
|
| 69 |
+
- here
|
| 70 |
+
version: '0.1'
|
| 71 |
+
creator:
|
| 72 |
+
name: Your Name
|
| 73 |
+
email: your@email.com
|
| 74 |
+
website: https://yourwebsite.com
|
| 75 |
+
any: All meta data above is arbitrary, it can be whatever you want.
|
generate.example.yaml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
|
| 3 |
+
job: generate # tells the runner what to do
|
| 4 |
+
config:
|
| 5 |
+
name: "generate" # this is not really used anywhere currently but required by runner
|
| 6 |
+
process:
|
| 7 |
+
# process 1
|
| 8 |
+
- type: to_folder # process images to a folder
|
| 9 |
+
output_folder: "output/gen"
|
| 10 |
+
device: cuda:0 # cpu, cuda:0, etc
|
| 11 |
+
generate:
|
| 12 |
+
# these are your defaults you can override most of them with flags
|
| 13 |
+
sampler: "ddpm" # ignored for now, will add later though ddpm is used regardless for now
|
| 14 |
+
width: 1024
|
| 15 |
+
height: 1024
|
| 16 |
+
neg: "cartoon, fake, drawing, illustration, cgi, animated, anime"
|
| 17 |
+
seed: -1 # -1 is random
|
| 18 |
+
guidance_scale: 7
|
| 19 |
+
sample_steps: 20
|
| 20 |
+
ext: ".png" # .png, .jpg, .jpeg, .webp
|
| 21 |
+
|
| 22 |
+
# here ate the flags you can use for prompts. Always start with
|
| 23 |
+
# your prompt first then add these flags after. You can use as many
|
| 24 |
+
# like
|
| 25 |
+
# photo of a baseball --n painting, ugly --w 1024 --h 1024 --seed 42 --cfg 7 --steps 20
|
| 26 |
+
# we will try to support all sd-scripts flags where we can
|
| 27 |
+
|
| 28 |
+
# FROM SD-SCRIPTS
|
| 29 |
+
# --n Treat everything until the next option as a negative prompt.
|
| 30 |
+
# --w Specify the width of the generated image.
|
| 31 |
+
# --h Specify the height of the generated image.
|
| 32 |
+
# --d Specify the seed for the generated image.
|
| 33 |
+
# --l Specify the CFG scale for the generated image.
|
| 34 |
+
# --s Specify the number of steps during generation.
|
| 35 |
+
|
| 36 |
+
# OURS and some QOL additions
|
| 37 |
+
# --p2 Prompt for the second text encoder (SDXL only)
|
| 38 |
+
# --n2 Negative prompt for the second text encoder (SDXL only)
|
| 39 |
+
# --gr Specify the guidance rescale for the generated image (SDXL only)
|
| 40 |
+
# --seed Specify the seed for the generated image same as --d
|
| 41 |
+
# --cfg Specify the CFG scale for the generated image same as --l
|
| 42 |
+
# --steps Specify the number of steps during generation same as --s
|
| 43 |
+
|
| 44 |
+
prompt_file: false # if true a txt file will be created next to images with prompt strings used
|
| 45 |
+
# prompts can also be a path to a text file with one prompt per line
|
| 46 |
+
# prompts: "/path/to/prompts.txt"
|
| 47 |
+
prompts:
|
| 48 |
+
- "photo of batman"
|
| 49 |
+
- "photo of superman"
|
| 50 |
+
- "photo of spiderman"
|
| 51 |
+
- "photo of a superhero --n batman superman spiderman"
|
| 52 |
+
|
| 53 |
+
model:
|
| 54 |
+
# huggingface name, relative prom project path, or absolute path to .safetensors or .ckpt
|
| 55 |
+
# name_or_path: "runwayml/stable-diffusion-v1-5"
|
| 56 |
+
name_or_path: "/mnt/Models/stable-diffusion/models/stable-diffusion/Ostris/Ostris_Real_v1.safetensors"
|
| 57 |
+
is_v2: false # for v2 models
|
| 58 |
+
is_v_pred: false # for v-prediction models (most v2 models)
|
| 59 |
+
is_xl: false # for SDXL models
|
| 60 |
+
dtype: bf16
|
mod_lora_scale.yaml
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: mod
|
| 3 |
+
config:
|
| 4 |
+
name: name_of_your_model_v1
|
| 5 |
+
process:
|
| 6 |
+
- type: rescale_lora
|
| 7 |
+
# path to your current lora model
|
| 8 |
+
input_path: "/path/to/lora/lora.safetensors"
|
| 9 |
+
# output path for your new lora model, can be the same as input_path to replace
|
| 10 |
+
output_path: "/path/to/lora/output_lora_v1.safetensors"
|
| 11 |
+
# replaces meta with the meta below (plus minimum meta fields)
|
| 12 |
+
# if false, we will leave the meta alone except for updating hashes (sd-script hashes)
|
| 13 |
+
replace_meta: true
|
| 14 |
+
# how to adjust, we can scale the up_down weights or the alpha
|
| 15 |
+
# up_down is the default and probably the best, they will both net the same outputs
|
| 16 |
+
# would only affect rare NaN cases and maybe merging with old merge tools
|
| 17 |
+
scale_target: 'up_down'
|
| 18 |
+
# precision to save, fp16 is the default and standard
|
| 19 |
+
save_dtype: fp16
|
| 20 |
+
# current_weight is the ideal weight you use as a multiplier when using the lora
|
| 21 |
+
# IE in automatic1111 <lora:my_lora:6.0> the 6.0 is the current_weight
|
| 22 |
+
# you can do negatives here too if you want to flip the lora
|
| 23 |
+
current_weight: 6.0
|
| 24 |
+
# target_weight is the ideal weight you use as a multiplier when using the lora
|
| 25 |
+
# instead of the one above. IE in automatic1111 instead of using <lora:my_lora:6.0>
|
| 26 |
+
# we want to use <lora:my_lora:1.0> so 1.0 is the target_weight
|
| 27 |
+
target_weight: 1.0
|
| 28 |
+
|
| 29 |
+
# base model for the lora
|
| 30 |
+
# this is just used to add meta so automatic111 knows which model it is for
|
| 31 |
+
# assume v1.5 if these are not set
|
| 32 |
+
is_xl: false
|
| 33 |
+
is_v2: false
|
| 34 |
+
meta:
|
| 35 |
+
# this is only used if you set replace_meta to true above
|
| 36 |
+
name: "[name]" # [name] gets replaced with the name above
|
| 37 |
+
description: A short description of your lora
|
| 38 |
+
trigger_words:
|
| 39 |
+
- put
|
| 40 |
+
- trigger
|
| 41 |
+
- words
|
| 42 |
+
- here
|
| 43 |
+
version: '0.1'
|
| 44 |
+
creator:
|
| 45 |
+
name: Your Name
|
| 46 |
+
email: your@email.com
|
| 47 |
+
website: https://yourwebsite.com
|
| 48 |
+
any: All meta data above is arbitrary, it can be whatever you want.
|
modal/modal_train_lora_flux_24gb.yaml
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_flux_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "/root/ai-toolkit/modal_output" # must match MOUNT_DIR from run_modal.py
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# trigger_word: "p3r5on"
|
| 16 |
+
network:
|
| 17 |
+
type: "lora"
|
| 18 |
+
linear: 16
|
| 19 |
+
linear_alpha: 16
|
| 20 |
+
save:
|
| 21 |
+
dtype: float16 # precision to save
|
| 22 |
+
save_every: 250 # save every this many steps
|
| 23 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 24 |
+
datasets:
|
| 25 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 26 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 27 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 28 |
+
# on windows, escape back slashes with another backslash so
|
| 29 |
+
# "C:\\path\\to\\images\\folder"
|
| 30 |
+
# your dataset must be placed in /ai-toolkit and /root is for modal to find the dir:
|
| 31 |
+
- folder_path: "/root/ai-toolkit/your-dataset"
|
| 32 |
+
caption_ext: "txt"
|
| 33 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 34 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 35 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 36 |
+
resolution: [ 512, 768, 1024 ] # flux enjoys multiple resolutions
|
| 37 |
+
train:
|
| 38 |
+
batch_size: 1
|
| 39 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 40 |
+
gradient_accumulation_steps: 1
|
| 41 |
+
train_unet: true
|
| 42 |
+
train_text_encoder: false # probably won't work with flux
|
| 43 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 44 |
+
noise_scheduler: "flowmatch" # for training only
|
| 45 |
+
optimizer: "adamw8bit"
|
| 46 |
+
lr: 1e-4
|
| 47 |
+
# uncomment this to skip the pre training sample
|
| 48 |
+
# skip_first_sample: true
|
| 49 |
+
# uncomment to completely disable sampling
|
| 50 |
+
# disable_sampling: true
|
| 51 |
+
# uncomment to use new vell curved weighting. Experimental but may produce better results
|
| 52 |
+
# linear_timesteps: true
|
| 53 |
+
|
| 54 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on.
|
| 55 |
+
ema_config:
|
| 56 |
+
use_ema: true
|
| 57 |
+
ema_decay: 0.99
|
| 58 |
+
|
| 59 |
+
# will probably need this if gpu supports it for flux, other dtypes may not work correctly
|
| 60 |
+
dtype: bf16
|
| 61 |
+
model:
|
| 62 |
+
# huggingface model name or path
|
| 63 |
+
# if you get an error, or get stuck while downloading,
|
| 64 |
+
# check https://github.com/ostris/ai-toolkit/issues/84, download the model locally and
|
| 65 |
+
# place it like "/root/ai-toolkit/FLUX.1-dev"
|
| 66 |
+
name_or_path: "black-forest-labs/FLUX.1-dev"
|
| 67 |
+
is_flux: true
|
| 68 |
+
quantize: true # run 8bit mixed precision
|
| 69 |
+
# low_vram: true # uncomment this if the GPU is connected to your monitors. It will use less vram to quantize, but is slower.
|
| 70 |
+
sample:
|
| 71 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 72 |
+
sample_every: 250 # sample every this many steps
|
| 73 |
+
sample_start_step: 0 # start sampling at this step
|
| 74 |
+
width: 1024
|
| 75 |
+
height: 1024
|
| 76 |
+
prompts:
|
| 77 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 78 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 79 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 80 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 81 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 82 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 83 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 84 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 85 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 86 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 87 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 88 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 89 |
+
neg: "" # not used on flux
|
| 90 |
+
seed: 42
|
| 91 |
+
walk_seed: true
|
| 92 |
+
guidance_scale: 4
|
| 93 |
+
sample_steps: 20
|
| 94 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 95 |
+
meta:
|
| 96 |
+
name: "[name]"
|
| 97 |
+
version: '1.0'
|
modal/modal_train_lora_flux_schnell_24gb.yaml
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_flux_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "/root/ai-toolkit/modal_output" # must match MOUNT_DIR from run_modal.py
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# trigger_word: "p3r5on"
|
| 16 |
+
network:
|
| 17 |
+
type: "lora"
|
| 18 |
+
linear: 16
|
| 19 |
+
linear_alpha: 16
|
| 20 |
+
save:
|
| 21 |
+
dtype: float16 # precision to save
|
| 22 |
+
save_every: 250 # save every this many steps
|
| 23 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 24 |
+
datasets:
|
| 25 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 26 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 27 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 28 |
+
# on windows, escape back slashes with another backslash so
|
| 29 |
+
# "C:\\path\\to\\images\\folder"
|
| 30 |
+
# your dataset must be placed in /ai-toolkit and /root is for modal to find the dir:
|
| 31 |
+
- folder_path: "/root/ai-toolkit/your-dataset"
|
| 32 |
+
caption_ext: "txt"
|
| 33 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 34 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 35 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 36 |
+
resolution: [ 512, 768, 1024 ] # flux enjoys multiple resolutions
|
| 37 |
+
train:
|
| 38 |
+
batch_size: 1
|
| 39 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 40 |
+
gradient_accumulation_steps: 1
|
| 41 |
+
train_unet: true
|
| 42 |
+
train_text_encoder: false # probably won't work with flux
|
| 43 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 44 |
+
noise_scheduler: "flowmatch" # for training only
|
| 45 |
+
optimizer: "adamw8bit"
|
| 46 |
+
lr: 1e-4
|
| 47 |
+
# uncomment this to skip the pre training sample
|
| 48 |
+
# skip_first_sample: true
|
| 49 |
+
# uncomment to completely disable sampling
|
| 50 |
+
# disable_sampling: true
|
| 51 |
+
# uncomment to use new vell curved weighting. Experimental but may produce better results
|
| 52 |
+
# linear_timesteps: true
|
| 53 |
+
|
| 54 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on.
|
| 55 |
+
ema_config:
|
| 56 |
+
use_ema: true
|
| 57 |
+
ema_decay: 0.99
|
| 58 |
+
|
| 59 |
+
# will probably need this if gpu supports it for flux, other dtypes may not work correctly
|
| 60 |
+
dtype: bf16
|
| 61 |
+
model:
|
| 62 |
+
# huggingface model name or path
|
| 63 |
+
# if you get an error, or get stuck while downloading,
|
| 64 |
+
# check https://github.com/ostris/ai-toolkit/issues/84, download the models locally and
|
| 65 |
+
# place them like "/root/ai-toolkit/FLUX.1-schnell" and "/root/ai-toolkit/FLUX.1-schnell-training-adapter"
|
| 66 |
+
name_or_path: "black-forest-labs/FLUX.1-schnell"
|
| 67 |
+
assistant_lora_path: "ostris/FLUX.1-schnell-training-adapter" # Required for flux schnell training
|
| 68 |
+
is_flux: true
|
| 69 |
+
quantize: true # run 8bit mixed precision
|
| 70 |
+
# low_vram is painfully slow to fuse in the adapter avoid it unless absolutely necessary
|
| 71 |
+
# low_vram: true # uncomment this if the GPU is connected to your monitors. It will use less vram to quantize, but is slower.
|
| 72 |
+
sample:
|
| 73 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 74 |
+
sample_every: 250 # sample every this many steps
|
| 75 |
+
sample_start_step: 0 # start sampling at this step
|
| 76 |
+
width: 1024
|
| 77 |
+
height: 1024
|
| 78 |
+
prompts:
|
| 79 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 80 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 81 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 82 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 83 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 84 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 85 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 86 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 87 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 88 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 89 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 90 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 91 |
+
neg: "" # not used on flux
|
| 92 |
+
seed: 42
|
| 93 |
+
walk_seed: true
|
| 94 |
+
guidance_scale: 1 # schnell does not do guidance
|
| 95 |
+
sample_steps: 4 # 1 - 4 works well
|
| 96 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 97 |
+
meta:
|
| 98 |
+
name: "[name]"
|
| 99 |
+
version: '1.0'
|
train_flex_redux.yaml
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_flex_redux_finetune_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
adapter:
|
| 14 |
+
type: "redux"
|
| 15 |
+
# you can finetune an existing adapter or start from scratch. Set to null to start from scratch
|
| 16 |
+
name_or_path: '/local/path/to/redux_adapter_to_finetune.safetensors'
|
| 17 |
+
# name_or_path: null
|
| 18 |
+
# image_encoder_path: 'google/siglip-so400m-patch14-384' # Flux.1 redux adapter
|
| 19 |
+
image_encoder_path: 'google/siglip2-so400m-patch16-512' # Flex.1 512 redux adapter
|
| 20 |
+
# image_encoder_arch: 'siglip' # for Flux.1
|
| 21 |
+
image_encoder_arch: 'siglip2'
|
| 22 |
+
# You need a control input for each sample. Best to do squares for both images
|
| 23 |
+
test_img_path:
|
| 24 |
+
- "/path/to/x_01.jpg"
|
| 25 |
+
- "/path/to/x_02.jpg"
|
| 26 |
+
- "/path/to/x_03.jpg"
|
| 27 |
+
- "/path/to/x_04.jpg"
|
| 28 |
+
- "/path/to/x_05.jpg"
|
| 29 |
+
- "/path/to/x_06.jpg"
|
| 30 |
+
- "/path/to/x_07.jpg"
|
| 31 |
+
- "/path/to/x_08.jpg"
|
| 32 |
+
- "/path/to/x_09.jpg"
|
| 33 |
+
- "/path/to/x_10.jpg"
|
| 34 |
+
clip_layer: 'last_hidden_state'
|
| 35 |
+
train: true
|
| 36 |
+
save:
|
| 37 |
+
dtype: bf16 # precision to save
|
| 38 |
+
save_every: 250 # save every this many steps
|
| 39 |
+
max_step_saves_to_keep: 4
|
| 40 |
+
datasets:
|
| 41 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 42 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 43 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 44 |
+
# on windows, escape back slashes with another backslash so
|
| 45 |
+
# "C:\\path\\to\\images\\folder"
|
| 46 |
+
- folder_path: "/path/to/images/folder"
|
| 47 |
+
# clip_image_path is directory containting your control images. They must have filename as their train image. (extension does not matter)
|
| 48 |
+
# for normal redux, we are just recreating the same image, so you can use the same folder path above
|
| 49 |
+
clip_image_path: "/path/to/control/images/folder"
|
| 50 |
+
caption_ext: "txt"
|
| 51 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 52 |
+
resolution: [ 512, 768, 1024 ] # flex enjoys multiple resolutions
|
| 53 |
+
train:
|
| 54 |
+
# this is what I used for the 24GB card, but feel free to adjust
|
| 55 |
+
# total batch size is 6 here
|
| 56 |
+
batch_size: 3
|
| 57 |
+
gradient_accumulation: 2
|
| 58 |
+
|
| 59 |
+
# captions are not needed for this training, we cache a blank proompt and rely on the vision encoder
|
| 60 |
+
unload_text_encoder: true
|
| 61 |
+
|
| 62 |
+
loss_type: "mse"
|
| 63 |
+
train_unet: true
|
| 64 |
+
train_text_encoder: false
|
| 65 |
+
steps: 4000000 # I set this very high and stop when I like the results
|
| 66 |
+
content_or_style: balanced # content, style, balanced
|
| 67 |
+
gradient_checkpointing: true
|
| 68 |
+
noise_scheduler: "flowmatch" # or "ddpm", "lms", "euler_a"
|
| 69 |
+
timestep_type: "flux_shift"
|
| 70 |
+
optimizer: "adamw8bit"
|
| 71 |
+
lr: 1e-4
|
| 72 |
+
|
| 73 |
+
# this is for Flex.1, comment this out for FLUX.1-dev
|
| 74 |
+
bypass_guidance_embedding: true
|
| 75 |
+
|
| 76 |
+
dtype: bf16
|
| 77 |
+
ema_config:
|
| 78 |
+
use_ema: true
|
| 79 |
+
ema_decay: 0.99
|
| 80 |
+
model:
|
| 81 |
+
name_or_path: "ostris/Flex.1-alpha"
|
| 82 |
+
is_flux: true
|
| 83 |
+
quantize: true
|
| 84 |
+
text_encoder_bits: 8
|
| 85 |
+
sample:
|
| 86 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 87 |
+
sample_every: 250 # sample every this many steps
|
| 88 |
+
sample_start_step: 0 # start sampling at this step
|
| 89 |
+
width: 1024
|
| 90 |
+
height: 1024
|
| 91 |
+
# I leave half blank to test prompt and unprompted
|
| 92 |
+
prompts:
|
| 93 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 94 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 95 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 96 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 97 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 98 |
+
- ""
|
| 99 |
+
- ""
|
| 100 |
+
- ""
|
| 101 |
+
- ""
|
| 102 |
+
- ""
|
| 103 |
+
neg: ""
|
| 104 |
+
seed: 42
|
| 105 |
+
walk_seed: true
|
| 106 |
+
guidance_scale: 4
|
| 107 |
+
sample_steps: 25
|
| 108 |
+
network_multiplier: 1.0
|
| 109 |
+
|
| 110 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 111 |
+
meta:
|
| 112 |
+
name: "[name]"
|
| 113 |
+
version: '1.0'
|
train_full_fine_tune_flex.yaml
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
# This configuration requires 48GB of VRAM or more to operate
|
| 3 |
+
job: extension
|
| 4 |
+
config:
|
| 5 |
+
# this name will be the folder and filename name
|
| 6 |
+
name: "my_first_flex_finetune_v1"
|
| 7 |
+
process:
|
| 8 |
+
- type: 'sd_trainer'
|
| 9 |
+
# root folder to save training sessions/samples/weights
|
| 10 |
+
training_folder: "output"
|
| 11 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 12 |
+
# performance_log_every: 1000
|
| 13 |
+
device: cuda:0
|
| 14 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 15 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 16 |
+
# trigger_word: "p3r5on"
|
| 17 |
+
save:
|
| 18 |
+
dtype: bf16 # precision to save
|
| 19 |
+
save_every: 250 # save every this many steps
|
| 20 |
+
max_step_saves_to_keep: 2 # how many intermittent saves to keep
|
| 21 |
+
save_format: 'diffusers' # 'diffusers'
|
| 22 |
+
datasets:
|
| 23 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 24 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 25 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 26 |
+
# on windows, escape back slashes with another backslash so
|
| 27 |
+
# "C:\\path\\to\\images\\folder"
|
| 28 |
+
- folder_path: "/path/to/images/folder"
|
| 29 |
+
caption_ext: "txt"
|
| 30 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 31 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 32 |
+
# cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 33 |
+
resolution: [ 512, 768, 1024 ] # flex enjoys multiple resolutions
|
| 34 |
+
train:
|
| 35 |
+
batch_size: 1
|
| 36 |
+
# IMPORTANT! For Flex, you must bypass the guidance embedder during training
|
| 37 |
+
bypass_guidance_embedding: true
|
| 38 |
+
|
| 39 |
+
# can be 'sigmoid', 'linear', or 'lognorm_blend'
|
| 40 |
+
timestep_type: 'sigmoid'
|
| 41 |
+
|
| 42 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 43 |
+
gradient_accumulation: 1
|
| 44 |
+
train_unet: true
|
| 45 |
+
train_text_encoder: false # probably won't work with flex
|
| 46 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 47 |
+
noise_scheduler: "flowmatch" # for training only
|
| 48 |
+
optimizer: "adafactor"
|
| 49 |
+
lr: 3e-5
|
| 50 |
+
|
| 51 |
+
# Paramiter swapping can reduce vram requirements. Set factor from 1.0 to 0.0.
|
| 52 |
+
# 0.1 is 10% of paramiters active at easc step. Only works with adafactor
|
| 53 |
+
|
| 54 |
+
# do_paramiter_swapping: true
|
| 55 |
+
# paramiter_swapping_factor: 0.9
|
| 56 |
+
|
| 57 |
+
# uncomment this to skip the pre training sample
|
| 58 |
+
# skip_first_sample: true
|
| 59 |
+
# uncomment to completely disable sampling
|
| 60 |
+
# disable_sampling: true
|
| 61 |
+
|
| 62 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on if you have the vram
|
| 63 |
+
ema_config:
|
| 64 |
+
use_ema: true
|
| 65 |
+
ema_decay: 0.99
|
| 66 |
+
|
| 67 |
+
# will probably need this if gpu supports it for flex, other dtypes may not work correctly
|
| 68 |
+
dtype: bf16
|
| 69 |
+
model:
|
| 70 |
+
# huggingface model name or path
|
| 71 |
+
name_or_path: "ostris/Flex.1-alpha"
|
| 72 |
+
is_flux: true # flex is flux architecture
|
| 73 |
+
# full finetuning quantized models is a crapshoot and results in subpar outputs
|
| 74 |
+
# quantize: true
|
| 75 |
+
# you can quantize just the T5 text encoder here to save vram
|
| 76 |
+
quantize_te: true
|
| 77 |
+
# only train the transformer blocks
|
| 78 |
+
only_if_contains:
|
| 79 |
+
- "transformer.transformer_blocks."
|
| 80 |
+
- "transformer.single_transformer_blocks."
|
| 81 |
+
sample:
|
| 82 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 83 |
+
sample_every: 250 # sample every this many steps
|
| 84 |
+
sample_start_step: 0 # start sampling at this step
|
| 85 |
+
width: 1024
|
| 86 |
+
height: 1024
|
| 87 |
+
prompts:
|
| 88 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 89 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 90 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 91 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 92 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 93 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 94 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 95 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 96 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 97 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 98 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 99 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 100 |
+
neg: "" # not used on flex
|
| 101 |
+
seed: 42
|
| 102 |
+
walk_seed: true
|
| 103 |
+
guidance_scale: 4
|
| 104 |
+
sample_steps: 25
|
| 105 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 106 |
+
meta:
|
| 107 |
+
name: "[name]"
|
| 108 |
+
version: '1.0'
|
train_full_fine_tune_lumina.yaml
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
# This configuration requires 24GB of VRAM or more to operate
|
| 3 |
+
job: extension
|
| 4 |
+
config:
|
| 5 |
+
# this name will be the folder and filename name
|
| 6 |
+
name: "my_first_lumina_finetune_v1"
|
| 7 |
+
process:
|
| 8 |
+
- type: 'sd_trainer'
|
| 9 |
+
# root folder to save training sessions/samples/weights
|
| 10 |
+
training_folder: "output"
|
| 11 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 12 |
+
# performance_log_every: 1000
|
| 13 |
+
device: cuda:0
|
| 14 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 15 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 16 |
+
# trigger_word: "p3r5on"
|
| 17 |
+
save:
|
| 18 |
+
dtype: bf16 # precision to save
|
| 19 |
+
save_every: 250 # save every this many steps
|
| 20 |
+
max_step_saves_to_keep: 2 # how many intermittent saves to keep
|
| 21 |
+
save_format: 'diffusers' # 'diffusers'
|
| 22 |
+
datasets:
|
| 23 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 24 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 25 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 26 |
+
# on windows, escape back slashes with another backslash so
|
| 27 |
+
# "C:\\path\\to\\images\\folder"
|
| 28 |
+
- folder_path: "/path/to/images/folder"
|
| 29 |
+
caption_ext: "txt"
|
| 30 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 31 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 32 |
+
# cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 33 |
+
resolution: [ 512, 768, 1024 ] # lumina2 enjoys multiple resolutions
|
| 34 |
+
train:
|
| 35 |
+
batch_size: 1
|
| 36 |
+
|
| 37 |
+
# can be 'sigmoid', 'linear', or 'lumina2_shift'
|
| 38 |
+
timestep_type: 'lumina2_shift'
|
| 39 |
+
|
| 40 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 41 |
+
gradient_accumulation: 1
|
| 42 |
+
train_unet: true
|
| 43 |
+
train_text_encoder: false # probably won't work with lumina2
|
| 44 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 45 |
+
noise_scheduler: "flowmatch" # for training only
|
| 46 |
+
optimizer: "adafactor"
|
| 47 |
+
lr: 3e-5
|
| 48 |
+
|
| 49 |
+
# Paramiter swapping can reduce vram requirements. Set factor from 1.0 to 0.0.
|
| 50 |
+
# 0.1 is 10% of paramiters active at easc step. Only works with adafactor
|
| 51 |
+
|
| 52 |
+
# do_paramiter_swapping: true
|
| 53 |
+
# paramiter_swapping_factor: 0.9
|
| 54 |
+
|
| 55 |
+
# uncomment this to skip the pre training sample
|
| 56 |
+
# skip_first_sample: true
|
| 57 |
+
# uncomment to completely disable sampling
|
| 58 |
+
# disable_sampling: true
|
| 59 |
+
|
| 60 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on if you have the vram
|
| 61 |
+
# ema_config:
|
| 62 |
+
# use_ema: true
|
| 63 |
+
# ema_decay: 0.99
|
| 64 |
+
|
| 65 |
+
# will probably need this if gpu supports it for lumina2, other dtypes may not work correctly
|
| 66 |
+
dtype: bf16
|
| 67 |
+
model:
|
| 68 |
+
# huggingface model name or path
|
| 69 |
+
name_or_path: "Alpha-VLLM/Lumina-Image-2.0"
|
| 70 |
+
is_lumina2: true # lumina2 architecture
|
| 71 |
+
# you can quantize just the Gemma2 text encoder here to save vram
|
| 72 |
+
quantize_te: true
|
| 73 |
+
sample:
|
| 74 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 75 |
+
sample_every: 250 # sample every this many steps
|
| 76 |
+
sample_start_step: 0 # start sampling at this step
|
| 77 |
+
width: 1024
|
| 78 |
+
height: 1024
|
| 79 |
+
prompts:
|
| 80 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 81 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 82 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 83 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 84 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 85 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 86 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 87 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 88 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 89 |
+
- "photo of a cat that is half black and half orange tabby, split down the middle. The cat has on a blue tophat. They are holding a martini glass with a pink ball of yarn in it with green knitting needles sticking out, in one paw. In the other paw, they are holding a DVD case for a movie titled, \"This is a test\" that has a golden robot on it. In the background is a busy night club with a giant mushroom man dancing with a bear."
|
| 90 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 91 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 92 |
+
neg: ""
|
| 93 |
+
seed: 42
|
| 94 |
+
walk_seed: true
|
| 95 |
+
guidance_scale: 4.0
|
| 96 |
+
sample_steps: 25
|
| 97 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 98 |
+
meta:
|
| 99 |
+
name: "[name]"
|
| 100 |
+
version: '1.0'
|
train_lora_chroma_24gb.yaml
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_chroma_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# trigger_word: "p3r5on"
|
| 16 |
+
network:
|
| 17 |
+
type: "lora"
|
| 18 |
+
linear: 16
|
| 19 |
+
linear_alpha: 16
|
| 20 |
+
save:
|
| 21 |
+
dtype: float16 # precision to save
|
| 22 |
+
save_every: 250 # save every this many steps
|
| 23 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 24 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 25 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 26 |
+
# hf_repo_id: your-username/your-model-slug
|
| 27 |
+
# hf_private: true #whether the repo is private or public
|
| 28 |
+
datasets:
|
| 29 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 30 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 31 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 32 |
+
# on windows, escape back slashes with another backslash so
|
| 33 |
+
# "C:\\path\\to\\images\\folder"
|
| 34 |
+
- folder_path: "/path/to/images/folder"
|
| 35 |
+
caption_ext: "txt"
|
| 36 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 37 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 38 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 39 |
+
resolution: [ 512, 768, 1024 ] # chroma enjoys multiple resolutions
|
| 40 |
+
train:
|
| 41 |
+
batch_size: 1
|
| 42 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 43 |
+
gradient_accumulation: 1
|
| 44 |
+
train_unet: true
|
| 45 |
+
train_text_encoder: false # probably won't work with chroma
|
| 46 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 47 |
+
noise_scheduler: "flowmatch" # for training only
|
| 48 |
+
optimizer: "adamw8bit"
|
| 49 |
+
lr: 1e-4
|
| 50 |
+
# uncomment this to skip the pre training sample
|
| 51 |
+
# skip_first_sample: true
|
| 52 |
+
# uncomment to completely disable sampling
|
| 53 |
+
# disable_sampling: true
|
| 54 |
+
# uncomment to use new vell curved weighting. Experimental but may produce better results
|
| 55 |
+
# linear_timesteps: true
|
| 56 |
+
|
| 57 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on.
|
| 58 |
+
ema_config:
|
| 59 |
+
use_ema: true
|
| 60 |
+
ema_decay: 0.99
|
| 61 |
+
|
| 62 |
+
# will probably need this if gpu supports it for chroma, other dtypes may not work correctly
|
| 63 |
+
dtype: bf16
|
| 64 |
+
model:
|
| 65 |
+
# Download the whichever model you prefer from the Chroma repo
|
| 66 |
+
# https://huggingface.co/lodestones/Chroma/tree/main
|
| 67 |
+
# point to it here.
|
| 68 |
+
# name_or_path: "/path/to/chroma/chroma-unlocked-vVERSION.safetensors"
|
| 69 |
+
|
| 70 |
+
# using lodestones/Chroma will automatically use the latest version
|
| 71 |
+
name_or_path: "lodestones/Chroma"
|
| 72 |
+
|
| 73 |
+
# # You can also select a version of Chroma like so
|
| 74 |
+
# name_or_path: "lodestones/Chroma/v28"
|
| 75 |
+
|
| 76 |
+
arch: "chroma"
|
| 77 |
+
quantize: true # run 8bit mixed precision
|
| 78 |
+
sample:
|
| 79 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 80 |
+
sample_every: 250 # sample every this many steps
|
| 81 |
+
sample_start_step: 0 # start sampling at this step
|
| 82 |
+
width: 1024
|
| 83 |
+
height: 1024
|
| 84 |
+
prompts:
|
| 85 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 86 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 87 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 88 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 89 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 90 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 91 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 92 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 93 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 94 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 95 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 96 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 97 |
+
neg: "" # negative prompt, optional
|
| 98 |
+
seed: 42
|
| 99 |
+
walk_seed: true
|
| 100 |
+
guidance_scale: 4
|
| 101 |
+
sample_steps: 25
|
| 102 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 103 |
+
meta:
|
| 104 |
+
name: "[name]"
|
| 105 |
+
version: '1.0'
|
train_lora_flex2_24gb.yaml
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Note, Flex2 is a highly experimental WIP model. Finetuning a model with built in controls and inpainting has not
|
| 2 |
+
# been done before, so you will be experimenting with me on how to do it. This is my recommended setup, but this is highly
|
| 3 |
+
# subject to change as we learn more about how Flex2 works.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
job: extension
|
| 7 |
+
config:
|
| 8 |
+
# this name will be the folder and filename name
|
| 9 |
+
name: "my_first_flex2_lora_v1"
|
| 10 |
+
process:
|
| 11 |
+
- type: 'sd_trainer'
|
| 12 |
+
# root folder to save training sessions/samples/weights
|
| 13 |
+
training_folder: "output"
|
| 14 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 15 |
+
# performance_log_every: 1000
|
| 16 |
+
device: cuda:0
|
| 17 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 18 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 19 |
+
# trigger_word: "p3r5on"
|
| 20 |
+
network:
|
| 21 |
+
type: "lora"
|
| 22 |
+
linear: 32
|
| 23 |
+
linear_alpha: 32
|
| 24 |
+
save:
|
| 25 |
+
dtype: float16 # precision to save
|
| 26 |
+
save_every: 250 # save every this many steps
|
| 27 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 28 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 29 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 30 |
+
# hf_repo_id: your-username/your-model-slug
|
| 31 |
+
# hf_private: true #whether the repo is private or public
|
| 32 |
+
datasets:
|
| 33 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 34 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 35 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 36 |
+
# on windows, escape back slashes with another backslash so
|
| 37 |
+
# "C:\\path\\to\\images\\folder"
|
| 38 |
+
- folder_path: "/path/to/images/folder"
|
| 39 |
+
# Flex2 is trained with controls and inpainting. If you want the model to truely understand how the
|
| 40 |
+
# controls function with your dataset, it is a good idea to keep doing controls during training.
|
| 41 |
+
# this will automatically generate the controls for you before training. The current script is not
|
| 42 |
+
# fully optimized so this could be rather slow for large datasets, but it caches them to disk so it
|
| 43 |
+
# only needs to be done once. If you want to skip this step, you can set the controls to [] and it will
|
| 44 |
+
controls:
|
| 45 |
+
- "depth"
|
| 46 |
+
- "line"
|
| 47 |
+
- "pose"
|
| 48 |
+
- "inpaint"
|
| 49 |
+
|
| 50 |
+
# you can make custom inpainting images as well. These images must be webp or png format with an alpha.
|
| 51 |
+
# just erase the part of the image you want to inpaint and save it as a webp or png. Again, erase your
|
| 52 |
+
# train target. So the person if training a person. The automatic controls above with inpaint will
|
| 53 |
+
# just run a background remover mask and erase the foreground, which works well for subjects.
|
| 54 |
+
|
| 55 |
+
# inpaint_path: "/my/impaint/images"
|
| 56 |
+
|
| 57 |
+
# you can also specify existing control image pairs. It can handle multiple groups and will randomly
|
| 58 |
+
# select one for each step.
|
| 59 |
+
|
| 60 |
+
# control_path:
|
| 61 |
+
# - "/my/custom/control/images"
|
| 62 |
+
# - "/my/custom/control/images2"
|
| 63 |
+
|
| 64 |
+
caption_ext: "txt"
|
| 65 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 66 |
+
resolution: [ 512, 768, 1024 ] # flex2 enjoys multiple resolutions
|
| 67 |
+
train:
|
| 68 |
+
batch_size: 1
|
| 69 |
+
# IMPORTANT! For Flex2, you must bypass the guidance embedder during training
|
| 70 |
+
bypass_guidance_embedding: true
|
| 71 |
+
|
| 72 |
+
steps: 3000 # total number of steps to train 500 - 4000 is a good range
|
| 73 |
+
gradient_accumulation: 1
|
| 74 |
+
train_unet: true
|
| 75 |
+
train_text_encoder: false # probably won't work with flex2
|
| 76 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 77 |
+
noise_scheduler: "flowmatch" # for training only
|
| 78 |
+
# shift works well for training fast and learning composition and style.
|
| 79 |
+
# for just subject, you may want to change this to sigmoid
|
| 80 |
+
timestep_type: 'shift' # 'linear', 'sigmoid', 'shift'
|
| 81 |
+
optimizer: "adamw8bit"
|
| 82 |
+
lr: 1e-4
|
| 83 |
+
|
| 84 |
+
optimizer_params:
|
| 85 |
+
weight_decay: 1e-5
|
| 86 |
+
# uncomment this to skip the pre training sample
|
| 87 |
+
# skip_first_sample: true
|
| 88 |
+
# uncomment to completely disable sampling
|
| 89 |
+
# disable_sampling: true
|
| 90 |
+
# uncomment to use new vell curved weighting. Experimental but may produce better results
|
| 91 |
+
# linear_timesteps: true
|
| 92 |
+
|
| 93 |
+
# ema will smooth out learning, but could slow it down. Defaults off
|
| 94 |
+
ema_config:
|
| 95 |
+
use_ema: false
|
| 96 |
+
ema_decay: 0.99
|
| 97 |
+
|
| 98 |
+
# will probably need this if gpu supports it for flex, other dtypes may not work correctly
|
| 99 |
+
dtype: bf16
|
| 100 |
+
model:
|
| 101 |
+
# huggingface model name or path
|
| 102 |
+
name_or_path: "ostris/Flex.2-preview"
|
| 103 |
+
arch: "flex2"
|
| 104 |
+
quantize: true # run 8bit mixed precision
|
| 105 |
+
quantize_te: true
|
| 106 |
+
|
| 107 |
+
# you can pass special training infor for controls to the model here
|
| 108 |
+
# percentages are decimal based so 0.0 is 0% and 1.0 is 100% of the time.
|
| 109 |
+
model_kwargs:
|
| 110 |
+
# inverts the inpainting mask, good to learn outpainting as well, recommended 0.0 for characters
|
| 111 |
+
invert_inpaint_mask_chance: 0.5
|
| 112 |
+
# this will do a normal t2i training step without inpaint when dropped out. REcommended if you want
|
| 113 |
+
# your lora to be able to inference with and without inpainting.
|
| 114 |
+
inpaint_dropout: 0.5
|
| 115 |
+
# randomly drops out the control image. Dropout recvommended if your want it to work without controls as well.
|
| 116 |
+
control_dropout: 0.5
|
| 117 |
+
# does a random inpaint blob. Usually a good idea to keep. Without it, the model will learn to always 100%
|
| 118 |
+
# fill the inpaint area with your subject. This is not always a good thing.
|
| 119 |
+
inpaint_random_chance: 0.5
|
| 120 |
+
# generates random inpaint blobs if you did not provide an inpaint image for your dataset. Inpaint breaks down fast
|
| 121 |
+
# if you are not training with it. Controls are a little more robust and can be left out,
|
| 122 |
+
# but when in doubt, always leave this on
|
| 123 |
+
do_random_inpainting: false
|
| 124 |
+
# does random blurring of the inpaint mask. Helps prevent weird edge artifacts for real workd inpainting. Leave on.
|
| 125 |
+
random_blur_mask: true
|
| 126 |
+
# applies a small amount of random dialition and restriction to the inpaint mask. Helps with edge artifacts.
|
| 127 |
+
# Leave on.
|
| 128 |
+
random_dialate_mask: true
|
| 129 |
+
sample:
|
| 130 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 131 |
+
sample_every: 250 # sample every this many steps
|
| 132 |
+
sample_start_step: 0 # start sampling at this step
|
| 133 |
+
width: 1024
|
| 134 |
+
height: 1024
|
| 135 |
+
prompts:
|
| 136 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 137 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 138 |
+
|
| 139 |
+
# you can use a single inpaint or single control image on your samples.
|
| 140 |
+
# for controls, the ctrl_idx is 1, the images can be any name and image format.
|
| 141 |
+
# use either a pose/line/depth image or whatever you are training with. An example is
|
| 142 |
+
# - "photo of [trigger] --ctrl_idx 1 --ctrl_img /path/to/control/image.jpg"
|
| 143 |
+
|
| 144 |
+
# for an inpainting image, it must be png/webp. Erase the part of the image you want to inpaint
|
| 145 |
+
# IMPORTANT! the inpaint images must be ctrl_idx 0 and have .inpaint.{ext} in the name for this to work right.
|
| 146 |
+
# - "photo of [trigger] --ctrl_idx 0 --ctrl_img /path/to/inpaint/image.inpaint.png"
|
| 147 |
+
|
| 148 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 149 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 150 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 151 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 152 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 153 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 154 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 155 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 156 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 157 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 158 |
+
neg: "" # not used on flex2
|
| 159 |
+
seed: 42
|
| 160 |
+
walk_seed: true
|
| 161 |
+
guidance_scale: 4
|
| 162 |
+
sample_steps: 25
|
| 163 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 164 |
+
meta:
|
| 165 |
+
name: "[name]"
|
| 166 |
+
version: '1.0'
|
train_lora_flex_24gb.yaml
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_flex_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# trigger_word: "p3r5on"
|
| 16 |
+
network:
|
| 17 |
+
type: "lora"
|
| 18 |
+
linear: 16
|
| 19 |
+
linear_alpha: 16
|
| 20 |
+
save:
|
| 21 |
+
dtype: float16 # precision to save
|
| 22 |
+
save_every: 250 # save every this many steps
|
| 23 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 24 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 25 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 26 |
+
# hf_repo_id: your-username/your-model-slug
|
| 27 |
+
# hf_private: true #whether the repo is private or public
|
| 28 |
+
datasets:
|
| 29 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 30 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 31 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 32 |
+
# on windows, escape back slashes with another backslash so
|
| 33 |
+
# "C:\\path\\to\\images\\folder"
|
| 34 |
+
- folder_path: "/path/to/images/folder"
|
| 35 |
+
caption_ext: "txt"
|
| 36 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 37 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 38 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 39 |
+
resolution: [ 512, 768, 1024 ] # flex enjoys multiple resolutions
|
| 40 |
+
train:
|
| 41 |
+
batch_size: 1
|
| 42 |
+
# IMPORTANT! For Flex, you must bypass the guidance embedder during training
|
| 43 |
+
bypass_guidance_embedding: true
|
| 44 |
+
|
| 45 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 46 |
+
gradient_accumulation: 1
|
| 47 |
+
train_unet: true
|
| 48 |
+
train_text_encoder: false # probably won't work with flex
|
| 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 |
+
lr: 1e-4
|
| 53 |
+
# uncomment this to skip the pre training sample
|
| 54 |
+
# skip_first_sample: true
|
| 55 |
+
# uncomment to completely disable sampling
|
| 56 |
+
# disable_sampling: true
|
| 57 |
+
# uncomment to use new vell curved weighting. Experimental but may produce better results
|
| 58 |
+
# linear_timesteps: true
|
| 59 |
+
|
| 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 flex, other dtypes may not work correctly
|
| 66 |
+
dtype: bf16
|
| 67 |
+
model:
|
| 68 |
+
# huggingface model name or path
|
| 69 |
+
name_or_path: "ostris/Flex.1-alpha"
|
| 70 |
+
is_flux: true
|
| 71 |
+
quantize: true # run 8bit mixed precision
|
| 72 |
+
quantize_kwargs:
|
| 73 |
+
exclude:
|
| 74 |
+
- "*time_text_embed*" # exclude the time text embedder from quantization
|
| 75 |
+
sample:
|
| 76 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 77 |
+
sample_every: 250 # sample every this many steps
|
| 78 |
+
sample_start_step: 0 # start sampling at this step
|
| 79 |
+
width: 1024
|
| 80 |
+
height: 1024
|
| 81 |
+
prompts:
|
| 82 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 83 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 84 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 85 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 86 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 87 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 88 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 89 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 90 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 91 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 92 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 93 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 94 |
+
neg: "" # not used on flex
|
| 95 |
+
seed: 42
|
| 96 |
+
walk_seed: true
|
| 97 |
+
guidance_scale: 4
|
| 98 |
+
sample_steps: 25
|
| 99 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 100 |
+
meta:
|
| 101 |
+
name: "[name]"
|
| 102 |
+
version: '1.0'
|
train_lora_flux_24gb.yaml
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_flux_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# trigger_word: "p3r5on"
|
| 16 |
+
network:
|
| 17 |
+
type: "lora"
|
| 18 |
+
linear: 16
|
| 19 |
+
linear_alpha: 16
|
| 20 |
+
save:
|
| 21 |
+
dtype: float16 # precision to save
|
| 22 |
+
save_every: 250 # save every this many steps
|
| 23 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 24 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 25 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 26 |
+
# hf_repo_id: your-username/your-model-slug
|
| 27 |
+
# hf_private: true #whether the repo is private or public
|
| 28 |
+
datasets:
|
| 29 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 30 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 31 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 32 |
+
# on windows, escape back slashes with another backslash so
|
| 33 |
+
# "C:\\path\\to\\images\\folder"
|
| 34 |
+
- folder_path: "/path/to/images/folder"
|
| 35 |
+
caption_ext: "txt"
|
| 36 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 37 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 38 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 39 |
+
resolution: [ 512, 768, 1024 ] # flux enjoys multiple resolutions
|
| 40 |
+
train:
|
| 41 |
+
batch_size: 1
|
| 42 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 43 |
+
gradient_accumulation_steps: 1
|
| 44 |
+
train_unet: true
|
| 45 |
+
train_text_encoder: false # probably won't work with flux
|
| 46 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 47 |
+
noise_scheduler: "flowmatch" # for training only
|
| 48 |
+
optimizer: "adamw8bit"
|
| 49 |
+
lr: 1e-4
|
| 50 |
+
# uncomment this to skip the pre training sample
|
| 51 |
+
# skip_first_sample: true
|
| 52 |
+
# uncomment to completely disable sampling
|
| 53 |
+
# disable_sampling: true
|
| 54 |
+
# uncomment to use new vell curved weighting. Experimental but may produce better results
|
| 55 |
+
# linear_timesteps: true
|
| 56 |
+
|
| 57 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on.
|
| 58 |
+
ema_config:
|
| 59 |
+
use_ema: true
|
| 60 |
+
ema_decay: 0.99
|
| 61 |
+
|
| 62 |
+
# will probably need this if gpu supports it for flux, other dtypes may not work correctly
|
| 63 |
+
dtype: bf16
|
| 64 |
+
model:
|
| 65 |
+
# huggingface model name or path
|
| 66 |
+
name_or_path: "black-forest-labs/FLUX.1-dev"
|
| 67 |
+
is_flux: true
|
| 68 |
+
quantize: true # run 8bit mixed precision
|
| 69 |
+
# low_vram: true # uncomment this if the GPU is connected to your monitors. It will use less vram to quantize, but is slower.
|
| 70 |
+
sample:
|
| 71 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 72 |
+
sample_every: 250 # sample every this many steps
|
| 73 |
+
sample_start_step: 0 # start sampling at this step
|
| 74 |
+
width: 1024
|
| 75 |
+
height: 1024
|
| 76 |
+
prompts:
|
| 77 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 78 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 79 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 80 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 81 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 82 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 83 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 84 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 85 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 86 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 87 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 88 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 89 |
+
neg: "" # not used on flux
|
| 90 |
+
seed: 42
|
| 91 |
+
walk_seed: true
|
| 92 |
+
guidance_scale: 4
|
| 93 |
+
sample_steps: 20
|
| 94 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 95 |
+
meta:
|
| 96 |
+
name: "[name]"
|
| 97 |
+
version: '1.0'
|
train_lora_flux_kontext_24gb.yaml
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_flux_kontext_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# trigger_word: "p3r5on"
|
| 16 |
+
network:
|
| 17 |
+
type: "lora"
|
| 18 |
+
linear: 16
|
| 19 |
+
linear_alpha: 16
|
| 20 |
+
save:
|
| 21 |
+
dtype: float16 # precision to save
|
| 22 |
+
save_every: 250 # save every this many steps
|
| 23 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 24 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 25 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 26 |
+
# hf_repo_id: your-username/your-model-slug
|
| 27 |
+
# hf_private: true #whether the repo is private or public
|
| 28 |
+
datasets:
|
| 29 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 30 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 31 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 32 |
+
# on windows, escape back slashes with another backslash so
|
| 33 |
+
# "C:\\path\\to\\images\\folder"
|
| 34 |
+
- folder_path: "/path/to/images/folder"
|
| 35 |
+
# control path is the input images for kontext for a paired dataset. These are the source images you want to change.
|
| 36 |
+
# You can comment this out and only use normal images if you don't have a paired dataset.
|
| 37 |
+
# Control images need to match the filenames on the folder path but in
|
| 38 |
+
# a different folder. These do not need captions.
|
| 39 |
+
control_path: "/path/to/control/folder"
|
| 40 |
+
caption_ext: "txt"
|
| 41 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 42 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 43 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 44 |
+
# Kontext runs images in at 2x the latent size. It may OOM at 1024 resolution with 24GB vram.
|
| 45 |
+
resolution: [ 512, 768 ] # flux enjoys multiple resolutions
|
| 46 |
+
# resolution: [ 512, 768, 1024 ]
|
| 47 |
+
train:
|
| 48 |
+
batch_size: 1
|
| 49 |
+
steps: 3000 # total number of steps to train 500 - 4000 is a good range
|
| 50 |
+
gradient_accumulation_steps: 1
|
| 51 |
+
train_unet: true
|
| 52 |
+
train_text_encoder: false # probably won't work with flux
|
| 53 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 54 |
+
noise_scheduler: "flowmatch" # for training only
|
| 55 |
+
optimizer: "adamw8bit"
|
| 56 |
+
lr: 1e-4
|
| 57 |
+
timestep_type: "weighted" # sigmoid, linear, or weighted.
|
| 58 |
+
# uncomment this to skip the pre training sample
|
| 59 |
+
# skip_first_sample: true
|
| 60 |
+
# uncomment to completely disable sampling
|
| 61 |
+
# disable_sampling: true
|
| 62 |
+
|
| 63 |
+
# ema will smooth out learning, but could slow it down.
|
| 64 |
+
|
| 65 |
+
# ema_config:
|
| 66 |
+
# use_ema: true
|
| 67 |
+
# ema_decay: 0.99
|
| 68 |
+
|
| 69 |
+
# will probably need this if gpu supports it for flux, other dtypes may not work correctly
|
| 70 |
+
dtype: bf16
|
| 71 |
+
model:
|
| 72 |
+
# huggingface model name or path. This model is gated.
|
| 73 |
+
# visit https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev to accept the terms and conditions
|
| 74 |
+
# and then you can use this model.
|
| 75 |
+
name_or_path: "black-forest-labs/FLUX.1-Kontext-dev"
|
| 76 |
+
arch: "flux_kontext"
|
| 77 |
+
quantize: true # run 8bit mixed precision
|
| 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 # sample every this many steps
|
| 82 |
+
sample_start_step: 0 # start sampling at this step
|
| 83 |
+
width: 1024
|
| 84 |
+
height: 1024
|
| 85 |
+
prompts:
|
| 86 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 87 |
+
# the --ctrl_img path is the one loaded to apply the kontext editing to
|
| 88 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 89 |
+
- "make the person smile --ctrl_img /path/to/control/folder/person1.jpg"
|
| 90 |
+
- "give the person an afro --ctrl_img /path/to/control/folder/person1.jpg"
|
| 91 |
+
- "turn this image into a cartoon --ctrl_img /path/to/control/folder/person1.jpg"
|
| 92 |
+
- "put this person in an action film --ctrl_img /path/to/control/folder/person1.jpg"
|
| 93 |
+
- "make this person a rapper in a rap music video --ctrl_img /path/to/control/folder/person1.jpg"
|
| 94 |
+
- "make the person smile --ctrl_img /path/to/control/folder/person1.jpg"
|
| 95 |
+
- "give the person an afro --ctrl_img /path/to/control/folder/person1.jpg"
|
| 96 |
+
- "turn this image into a cartoon --ctrl_img /path/to/control/folder/person1.jpg"
|
| 97 |
+
- "put this person in an action film --ctrl_img /path/to/control/folder/person1.jpg"
|
| 98 |
+
- "make this person a rapper in a rap music video --ctrl_img /path/to/control/folder/person1.jpg"
|
| 99 |
+
neg: "" # not used on flux
|
| 100 |
+
seed: 42
|
| 101 |
+
walk_seed: true
|
| 102 |
+
guidance_scale: 4
|
| 103 |
+
sample_steps: 20
|
| 104 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 105 |
+
meta:
|
| 106 |
+
name: "[name]"
|
| 107 |
+
version: '1.0'
|
train_lora_flux_schnell_24gb.yaml
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_flux_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# trigger_word: "p3r5on"
|
| 16 |
+
network:
|
| 17 |
+
type: "lora"
|
| 18 |
+
linear: 16
|
| 19 |
+
linear_alpha: 16
|
| 20 |
+
save:
|
| 21 |
+
dtype: float16 # precision to save
|
| 22 |
+
save_every: 250 # save every this many steps
|
| 23 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 24 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 25 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 26 |
+
# hf_repo_id: your-username/your-model-slug
|
| 27 |
+
# hf_private: true #whether the repo is private or public
|
| 28 |
+
datasets:
|
| 29 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 30 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 31 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 32 |
+
# on windows, escape back slashes with another backslash so
|
| 33 |
+
# "C:\\path\\to\\images\\folder"
|
| 34 |
+
- folder_path: "/path/to/images/folder"
|
| 35 |
+
caption_ext: "txt"
|
| 36 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 37 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 38 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 39 |
+
resolution: [ 512, 768, 1024 ] # flux enjoys multiple resolutions
|
| 40 |
+
train:
|
| 41 |
+
batch_size: 1
|
| 42 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 43 |
+
gradient_accumulation_steps: 1
|
| 44 |
+
train_unet: true
|
| 45 |
+
train_text_encoder: false # probably won't work with flux
|
| 46 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 47 |
+
noise_scheduler: "flowmatch" # for training only
|
| 48 |
+
optimizer: "adamw8bit"
|
| 49 |
+
lr: 1e-4
|
| 50 |
+
# uncomment this to skip the pre training sample
|
| 51 |
+
# skip_first_sample: true
|
| 52 |
+
# uncomment to completely disable sampling
|
| 53 |
+
# disable_sampling: true
|
| 54 |
+
# uncomment to use new bell curved weighting. Experimental but may produce better results
|
| 55 |
+
# linear_timesteps: true
|
| 56 |
+
|
| 57 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on.
|
| 58 |
+
ema_config:
|
| 59 |
+
use_ema: true
|
| 60 |
+
ema_decay: 0.99
|
| 61 |
+
|
| 62 |
+
# will probably need this if gpu supports it for flux, other dtypes may not work correctly
|
| 63 |
+
dtype: bf16
|
| 64 |
+
model:
|
| 65 |
+
# huggingface model name or path
|
| 66 |
+
name_or_path: "black-forest-labs/FLUX.1-schnell"
|
| 67 |
+
assistant_lora_path: "ostris/FLUX.1-schnell-training-adapter" # Required for flux schnell training
|
| 68 |
+
is_flux: true
|
| 69 |
+
quantize: true # run 8bit mixed precision
|
| 70 |
+
# low_vram is painfully slow to fuse in the adapter avoid it unless absolutely necessary
|
| 71 |
+
# low_vram: true # uncomment this if the GPU is connected to your monitors. It will use less vram to quantize, but is slower.
|
| 72 |
+
sample:
|
| 73 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 74 |
+
sample_every: 250 # sample every this many steps
|
| 75 |
+
sample_start_step: 0 # start sampling at this step
|
| 76 |
+
width: 1024
|
| 77 |
+
height: 1024
|
| 78 |
+
prompts:
|
| 79 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 80 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 81 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 82 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 83 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 84 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 85 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 86 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 87 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 88 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 89 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 90 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 91 |
+
neg: "" # not used on flux
|
| 92 |
+
seed: 42
|
| 93 |
+
walk_seed: true
|
| 94 |
+
guidance_scale: 1 # schnell does not do guidance
|
| 95 |
+
sample_steps: 4 # 1 - 4 works well
|
| 96 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 97 |
+
meta:
|
| 98 |
+
name: "[name]"
|
| 99 |
+
version: '1.0'
|
train_lora_hidream_48.yaml
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HiDream training is still highly experimental. The settings here will take ~35.2GB of vram to train.
|
| 2 |
+
# It is not possible to train on a single 24GB card yet, but I am working on it. If you have more VRAM
|
| 3 |
+
# I highly recommend first disabling quantization on the model itself if you can. You can leave the TEs quantized.
|
| 4 |
+
# HiDream has a mixture of experts that may take special training considerations that I do not
|
| 5 |
+
# have implemented properly. The current implementation seems to work well for LoRA training, but
|
| 6 |
+
# may not be effective for longer training runs. The implementation could change in future updates
|
| 7 |
+
# so your results may vary when this happens.
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
job: extension
|
| 11 |
+
config:
|
| 12 |
+
# this name will be the folder and filename name
|
| 13 |
+
name: "my_first_hidream_lora_v1"
|
| 14 |
+
process:
|
| 15 |
+
- type: 'sd_trainer'
|
| 16 |
+
# root folder to save training sessions/samples/weights
|
| 17 |
+
training_folder: "output"
|
| 18 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 19 |
+
# performance_log_every: 1000
|
| 20 |
+
device: cuda:0
|
| 21 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 22 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 23 |
+
# trigger_word: "p3r5on"
|
| 24 |
+
network:
|
| 25 |
+
type: "lora"
|
| 26 |
+
linear: 32
|
| 27 |
+
linear_alpha: 32
|
| 28 |
+
network_kwargs:
|
| 29 |
+
# it is probably best to ignore the mixture of experts since only 2 are active each block. It works activating it, but I wouldnt.
|
| 30 |
+
# proper training of it is not fully implemented
|
| 31 |
+
ignore_if_contains:
|
| 32 |
+
- "ff_i.experts"
|
| 33 |
+
- "ff_i.gate"
|
| 34 |
+
save:
|
| 35 |
+
dtype: bfloat16 # precision to save
|
| 36 |
+
save_every: 250 # save every this many steps
|
| 37 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 38 |
+
datasets:
|
| 39 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 40 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 41 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 42 |
+
# on windows, escape back slashes with another backslash so
|
| 43 |
+
# "C:\\path\\to\\images\\folder"
|
| 44 |
+
- folder_path: "/path/to/images/folder"
|
| 45 |
+
caption_ext: "txt"
|
| 46 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 47 |
+
resolution: [ 512, 768, 1024 ] # hidream enjoys multiple resolutions
|
| 48 |
+
train:
|
| 49 |
+
batch_size: 1
|
| 50 |
+
steps: 3000 # total number of steps to train 500 - 4000 is a good range
|
| 51 |
+
gradient_accumulation_steps: 1
|
| 52 |
+
train_unet: true
|
| 53 |
+
train_text_encoder: false # wont work with hidream
|
| 54 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 55 |
+
noise_scheduler: "flowmatch" # for training only
|
| 56 |
+
timestep_type: shift # sigmoid, shift, linear
|
| 57 |
+
optimizer: "adamw8bit"
|
| 58 |
+
lr: 2e-4
|
| 59 |
+
# uncomment this to skip the pre training sample
|
| 60 |
+
# skip_first_sample: true
|
| 61 |
+
# uncomment to completely disable sampling
|
| 62 |
+
# disable_sampling: true
|
| 63 |
+
# uncomment to use new vell curved weighting. Experimental but may produce better results
|
| 64 |
+
# linear_timesteps: true
|
| 65 |
+
|
| 66 |
+
# ema will smooth out learning, but could slow it down. Defaults off
|
| 67 |
+
ema_config:
|
| 68 |
+
use_ema: false
|
| 69 |
+
ema_decay: 0.99
|
| 70 |
+
|
| 71 |
+
# will probably need this if gpu supports it for hidream, other dtypes may not work correctly
|
| 72 |
+
dtype: bf16
|
| 73 |
+
model:
|
| 74 |
+
# the transformer will get grabbed from this hf repo
|
| 75 |
+
# warning ONLY train on Full. The dev and fast models are distilled and will break
|
| 76 |
+
name_or_path: "HiDream-ai/HiDream-I1-Full"
|
| 77 |
+
# the extras will be grabbed from this hf repo. (text encoder, vae)
|
| 78 |
+
extras_name_or_path: "HiDream-ai/HiDream-I1-Full"
|
| 79 |
+
arch: "hidream"
|
| 80 |
+
# both need to be quantized to train on 48GB currently
|
| 81 |
+
quantize: true
|
| 82 |
+
quantize_te: true
|
| 83 |
+
model_kwargs:
|
| 84 |
+
# llama is a gated model, It defaults to unsloth version, but you can set the llama path here
|
| 85 |
+
llama_model_path: "unsloth/Meta-Llama-3.1-8B-Instruct"
|
| 86 |
+
sample:
|
| 87 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 88 |
+
sample_every: 250 # sample every this many steps
|
| 89 |
+
sample_start_step: 0 # start sampling at this step
|
| 90 |
+
width: 1024
|
| 91 |
+
height: 1024
|
| 92 |
+
prompts:
|
| 93 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 94 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 95 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 96 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 97 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 98 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 99 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 100 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 101 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 102 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 103 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 104 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 105 |
+
neg: ""
|
| 106 |
+
seed: 42
|
| 107 |
+
walk_seed: true
|
| 108 |
+
guidance_scale: 4
|
| 109 |
+
sample_steps: 25
|
| 110 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 111 |
+
meta:
|
| 112 |
+
name: "[name]"
|
| 113 |
+
version: '1.0'
|
train_lora_lumina.yaml
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
# This configuration requires 20GB of VRAM or more to operate
|
| 3 |
+
job: extension
|
| 4 |
+
config:
|
| 5 |
+
# this name will be the folder and filename name
|
| 6 |
+
name: "my_first_lumina_lora_v1"
|
| 7 |
+
process:
|
| 8 |
+
- type: 'sd_trainer'
|
| 9 |
+
# root folder to save training sessions/samples/weights
|
| 10 |
+
training_folder: "output"
|
| 11 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 12 |
+
# performance_log_every: 1000
|
| 13 |
+
device: cuda:0
|
| 14 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 15 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 16 |
+
# trigger_word: "p3r5on"
|
| 17 |
+
network:
|
| 18 |
+
type: "lora"
|
| 19 |
+
linear: 16
|
| 20 |
+
linear_alpha: 16
|
| 21 |
+
save:
|
| 22 |
+
dtype: bf16 # precision to save
|
| 23 |
+
save_every: 250 # save every this many steps
|
| 24 |
+
max_step_saves_to_keep: 2 # how many intermittent saves to keep
|
| 25 |
+
save_format: 'diffusers' # 'diffusers'
|
| 26 |
+
datasets:
|
| 27 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 28 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 29 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 30 |
+
# on windows, escape back slashes with another backslash so
|
| 31 |
+
# "C:\\path\\to\\images\\folder"
|
| 32 |
+
- folder_path: "/path/to/images/folder"
|
| 33 |
+
caption_ext: "txt"
|
| 34 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 35 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 36 |
+
# cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 37 |
+
resolution: [ 512, 768, 1024 ] # lumina2 enjoys multiple resolutions
|
| 38 |
+
train:
|
| 39 |
+
batch_size: 1
|
| 40 |
+
|
| 41 |
+
# can be 'sigmoid', 'linear', or 'lumina2_shift'
|
| 42 |
+
timestep_type: 'lumina2_shift'
|
| 43 |
+
|
| 44 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 45 |
+
gradient_accumulation: 1
|
| 46 |
+
train_unet: true
|
| 47 |
+
train_text_encoder: false # probably won't work with lumina2
|
| 48 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 49 |
+
noise_scheduler: "flowmatch" # for training only
|
| 50 |
+
optimizer: "adamw8bit"
|
| 51 |
+
lr: 1e-4
|
| 52 |
+
# uncomment this to skip the pre training sample
|
| 53 |
+
# skip_first_sample: true
|
| 54 |
+
# uncomment to completely disable sampling
|
| 55 |
+
# disable_sampling: true
|
| 56 |
+
|
| 57 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on if you have the vram
|
| 58 |
+
ema_config:
|
| 59 |
+
use_ema: true
|
| 60 |
+
ema_decay: 0.99
|
| 61 |
+
|
| 62 |
+
# will probably need this if gpu supports it for lumina2, other dtypes may not work correctly
|
| 63 |
+
dtype: bf16
|
| 64 |
+
model:
|
| 65 |
+
# huggingface model name or path
|
| 66 |
+
name_or_path: "Alpha-VLLM/Lumina-Image-2.0"
|
| 67 |
+
is_lumina2: true # lumina2 architecture
|
| 68 |
+
# you can quantize just the Gemma2 text encoder here to save vram
|
| 69 |
+
quantize_te: true
|
| 70 |
+
sample:
|
| 71 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 72 |
+
sample_every: 250 # sample every this many steps
|
| 73 |
+
sample_start_step: 0 # start sampling at this step
|
| 74 |
+
width: 1024
|
| 75 |
+
height: 1024
|
| 76 |
+
prompts:
|
| 77 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 78 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 79 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 80 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 81 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 82 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 83 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 84 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 85 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 86 |
+
- "photo of a cat that is half black and half orange tabby, split down the middle. The cat has on a blue tophat. They are holding a martini glass with a pink ball of yarn in it with green knitting needles sticking out, in one paw. In the other paw, they are holding a DVD case for a movie titled, \"This is a test\" that has a golden robot on it. In the background is a busy night club with a giant mushroom man dancing with a bear."
|
| 87 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 88 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 89 |
+
neg: ""
|
| 90 |
+
seed: 42
|
| 91 |
+
walk_seed: true
|
| 92 |
+
guidance_scale: 4.0
|
| 93 |
+
sample_steps: 25
|
| 94 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 95 |
+
meta:
|
| 96 |
+
name: "[name]"
|
| 97 |
+
version: '1.0'
|
train_lora_omnigen2_24gb.yaml
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_omnigen2_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# trigger_word: "p3r5on"
|
| 16 |
+
network:
|
| 17 |
+
type: "lora"
|
| 18 |
+
linear: 16
|
| 19 |
+
linear_alpha: 16
|
| 20 |
+
save:
|
| 21 |
+
dtype: float16 # precision to save
|
| 22 |
+
save_every: 250 # save every this many steps
|
| 23 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 24 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 25 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 26 |
+
# hf_repo_id: your-username/your-model-slug
|
| 27 |
+
# hf_private: true #whether the repo is private or public
|
| 28 |
+
datasets:
|
| 29 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 30 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 31 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 32 |
+
# on windows, escape back slashes with another backslash so
|
| 33 |
+
# "C:\\path\\to\\images\\folder"
|
| 34 |
+
- folder_path: "/path/to/images/folder"
|
| 35 |
+
caption_ext: "txt"
|
| 36 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 37 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 38 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 39 |
+
resolution: [ 512, 768, 1024 ] # omnigen2 should work with multiple resolutions
|
| 40 |
+
train:
|
| 41 |
+
batch_size: 1
|
| 42 |
+
steps: 3000 # total number of steps to train 500 - 4000 is a good range
|
| 43 |
+
gradient_accumulation: 1
|
| 44 |
+
train_unet: true
|
| 45 |
+
train_text_encoder: false # probably won't work with omnigen2
|
| 46 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 47 |
+
noise_scheduler: "flowmatch" # for training only
|
| 48 |
+
optimizer: "adamw8bit"
|
| 49 |
+
lr: 1e-4
|
| 50 |
+
timestep_type: 'sigmoid' # sigmoid, linear, shift
|
| 51 |
+
# uncomment this to skip the pre training sample
|
| 52 |
+
# skip_first_sample: true
|
| 53 |
+
# uncomment to completely disable sampling
|
| 54 |
+
# disable_sampling: true
|
| 55 |
+
|
| 56 |
+
# ema will smooth out learning, but could slow it down.
|
| 57 |
+
# ema_config:
|
| 58 |
+
# use_ema: true
|
| 59 |
+
# ema_decay: 0.99
|
| 60 |
+
|
| 61 |
+
# will probably need this if gpu supports it for omnigen2, other dtypes may not work correctly
|
| 62 |
+
dtype: bf16
|
| 63 |
+
model:
|
| 64 |
+
name_or_path: "OmniGen2/OmniGen2
|
| 65 |
+
arch: "omnigen2"
|
| 66 |
+
quantize_te: true # quantize_only te
|
| 67 |
+
# quantize: true # quantize transformer
|
| 68 |
+
sample:
|
| 69 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 70 |
+
sample_every: 250 # sample every this many steps
|
| 71 |
+
sample_start_step: 0 # start sampling at this step
|
| 72 |
+
width: 1024
|
| 73 |
+
height: 1024
|
| 74 |
+
prompts:
|
| 75 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 76 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 77 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 78 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 79 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 80 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 81 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 82 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 83 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 84 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 85 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 86 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 87 |
+
neg: "" # negative prompt, optional
|
| 88 |
+
seed: 42
|
| 89 |
+
walk_seed: true
|
| 90 |
+
guidance_scale: 4
|
| 91 |
+
sample_steps: 25
|
| 92 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 93 |
+
meta:
|
| 94 |
+
name: "[name]"
|
| 95 |
+
version: '1.0'
|
train_lora_qwen_image_24gb.yaml
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_qwen_image_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# Trigger words will not work when caching text embeddings
|
| 16 |
+
# trigger_word: "p3r5on"
|
| 17 |
+
network:
|
| 18 |
+
type: "lora"
|
| 19 |
+
linear: 16
|
| 20 |
+
linear_alpha: 16
|
| 21 |
+
save:
|
| 22 |
+
dtype: float16 # precision to save
|
| 23 |
+
save_every: 250 # save every this many steps
|
| 24 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 25 |
+
datasets:
|
| 26 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 27 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 28 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 29 |
+
# on windows, escape back slashes with another backslash so
|
| 30 |
+
# "C:\\path\\to\\images\\folder"
|
| 31 |
+
- folder_path: "/path/to/images/folder"
|
| 32 |
+
caption_ext: "txt"
|
| 33 |
+
# default_caption: "a person" # if caching text embeddings, if you dont have captions, this will get cached
|
| 34 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 35 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 36 |
+
cache_latents_to_disk: true # leave this true unless you have a large dataset
|
| 37 |
+
# if you OOM, 1024 may be too much, but should work
|
| 38 |
+
resolution: [ 512, 768, 1024 ] # qwen image enjoys multiple resolutions
|
| 39 |
+
train:
|
| 40 |
+
batch_size: 1
|
| 41 |
+
# caching text embeddings is required for 24GB
|
| 42 |
+
cache_text_embeddings: true
|
| 43 |
+
|
| 44 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 45 |
+
gradient_accumulation: 1
|
| 46 |
+
train_unet: true
|
| 47 |
+
train_text_encoder: false # probably won't work with qwen image
|
| 48 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 49 |
+
noise_scheduler: "flowmatch" # for training only
|
| 50 |
+
optimizer: "adamw8bit"
|
| 51 |
+
lr: 1e-4
|
| 52 |
+
# uncomment this to skip the pre training sample
|
| 53 |
+
# skip_first_sample: true
|
| 54 |
+
# uncomment to completely disable sampling
|
| 55 |
+
# disable_sampling: true
|
| 56 |
+
dtype: bf16
|
| 57 |
+
model:
|
| 58 |
+
# huggingface model name or path
|
| 59 |
+
name_or_path: "Qwen/Qwen-Image"
|
| 60 |
+
arch: "qwen_image"
|
| 61 |
+
quantize: true
|
| 62 |
+
# qtype_te: "qfloat8" Default float8 qquantization
|
| 63 |
+
# to use the ARA use the | pipe to point to hf path, or a local path if you have one.
|
| 64 |
+
# 3bit is required for 24GB
|
| 65 |
+
qtype: "uint3|ostris/accuracy_recovery_adapters/qwen_image_torchao_uint3.safetensors"
|
| 66 |
+
quantize_te: true
|
| 67 |
+
qtype_te: "qfloat8"
|
| 68 |
+
low_vram: true
|
| 69 |
+
sample:
|
| 70 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 71 |
+
sample_every: 250 # sample every this many steps
|
| 72 |
+
sample_start_step: 0 # start sampling at this step
|
| 73 |
+
width: 1024
|
| 74 |
+
height: 1024
|
| 75 |
+
prompts:
|
| 76 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 77 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 78 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 79 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 80 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 81 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 82 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 83 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 84 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 85 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 86 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 87 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 88 |
+
neg: ""
|
| 89 |
+
seed: 42
|
| 90 |
+
walk_seed: true
|
| 91 |
+
guidance_scale: 3
|
| 92 |
+
sample_steps: 25
|
| 93 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 94 |
+
meta:
|
| 95 |
+
name: "[name]"
|
| 96 |
+
version: '1.0'
|
train_lora_qwen_image_edit_2509_32gb.yaml
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_qwen_image_edit_2509_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'diffusion_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
network:
|
| 14 |
+
type: "lora"
|
| 15 |
+
linear: 16
|
| 16 |
+
linear_alpha: 16
|
| 17 |
+
save:
|
| 18 |
+
dtype: float16 # precision to save
|
| 19 |
+
save_every: 250 # save every this many steps
|
| 20 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 21 |
+
datasets:
|
| 22 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 23 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 24 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 25 |
+
# on windows, escape back slashes with another backslash so
|
| 26 |
+
# "C:\\path\\to\\images\\folder"
|
| 27 |
+
- folder_path: "/path/to/images/folder"
|
| 28 |
+
# can do up to 3 control image folders, file names must match target file names, but aspect/size can be different
|
| 29 |
+
control_path:
|
| 30 |
+
- "/path/to/control/images/folder1"
|
| 31 |
+
- "/path/to/control/images/folder2"
|
| 32 |
+
- "/path/to/control/images/folder3"
|
| 33 |
+
caption_ext: "txt"
|
| 34 |
+
# default_caption: "a person" # if caching text embeddings, if you don't have captions, this will get cached
|
| 35 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 36 |
+
resolution: [ 512, 768, 1024 ] # qwen image enjoys multiple resolutions
|
| 37 |
+
# a trigger word that can be cached with the text embeddings
|
| 38 |
+
# trigger_word: "optional trigger word"
|
| 39 |
+
train:
|
| 40 |
+
batch_size: 1
|
| 41 |
+
# caching text embeddings is required for 32GB
|
| 42 |
+
cache_text_embeddings: true
|
| 43 |
+
# unload_text_encoder: true
|
| 44 |
+
|
| 45 |
+
steps: 3000 # total number of steps to train 500 - 4000 is a good range
|
| 46 |
+
gradient_accumulation: 1
|
| 47 |
+
timestep_type: "weighted"
|
| 48 |
+
train_unet: true
|
| 49 |
+
train_text_encoder: false # probably won't work with qwen image
|
| 50 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 51 |
+
noise_scheduler: "flowmatch" # for training only
|
| 52 |
+
optimizer: "adamw8bit"
|
| 53 |
+
lr: 1e-4
|
| 54 |
+
# uncomment this to skip the pre training sample
|
| 55 |
+
# skip_first_sample: true
|
| 56 |
+
# uncomment to completely disable sampling
|
| 57 |
+
# disable_sampling: true
|
| 58 |
+
dtype: bf16
|
| 59 |
+
model:
|
| 60 |
+
# huggingface model name or path
|
| 61 |
+
name_or_path: "Qwen/Qwen-Image-Edit-2509"
|
| 62 |
+
arch: "qwen_image_edit_plus"
|
| 63 |
+
quantize: true
|
| 64 |
+
# to use the ARA use the | pipe to point to hf path, or a local path if you have one.
|
| 65 |
+
# 3bit is required for 32GB
|
| 66 |
+
qtype: "uint3|ostris/accuracy_recovery_adapters/qwen_image_edit_2509_torchao_uint3.safetensors"
|
| 67 |
+
quantize_te: true
|
| 68 |
+
qtype_te: "qfloat8"
|
| 69 |
+
low_vram: true
|
| 70 |
+
sample:
|
| 71 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 72 |
+
sample_every: 250 # sample every this many steps
|
| 73 |
+
sample_start_step: 0 # start sampling at this step
|
| 74 |
+
width: 1024
|
| 75 |
+
height: 1024
|
| 76 |
+
# you can provide up to 3 control images here
|
| 77 |
+
samples:
|
| 78 |
+
- prompt: "Do whatever with Image1 and Image2"
|
| 79 |
+
ctrl_img_1: "/path/to/image1.png"
|
| 80 |
+
ctrl_img_2: "/path/to/image2.png"
|
| 81 |
+
# ctrl_img_3: "/path/to/image3.png"
|
| 82 |
+
- prompt: "Do whatever with Image1 and Image2"
|
| 83 |
+
ctrl_img_1: "/path/to/image1.png"
|
| 84 |
+
ctrl_img_2: "/path/to/image2.png"
|
| 85 |
+
# ctrl_img_3: "/path/to/image3.png"
|
| 86 |
+
- prompt: "Do whatever with Image1 and Image2"
|
| 87 |
+
ctrl_img_1: "/path/to/image1.png"
|
| 88 |
+
ctrl_img_2: "/path/to/image2.png"
|
| 89 |
+
# ctrl_img_3: "/path/to/image3.png"
|
| 90 |
+
- prompt: "Do whatever with Image1 and Image2"
|
| 91 |
+
ctrl_img_1: "/path/to/image1.png"
|
| 92 |
+
ctrl_img_2: "/path/to/image2.png"
|
| 93 |
+
# ctrl_img_3: "/path/to/image3.png"
|
| 94 |
+
- prompt: "Do whatever with Image1 and Image2"
|
| 95 |
+
ctrl_img_1: "/path/to/image1.png"
|
| 96 |
+
ctrl_img_2: "/path/to/image2.png"
|
| 97 |
+
# ctrl_img_3: "/path/to/image3.png"
|
| 98 |
+
neg: ""
|
| 99 |
+
seed: 42
|
| 100 |
+
walk_seed: true
|
| 101 |
+
guidance_scale: 3
|
| 102 |
+
sample_steps: 25
|
| 103 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 104 |
+
meta:
|
| 105 |
+
name: "[name]"
|
| 106 |
+
version: '1.0'
|
train_lora_qwen_image_edit_32gb.yaml
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_qwen_image_edit_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# Trigger words will not work when caching text embeddings
|
| 16 |
+
# trigger_word: "p3r5on"
|
| 17 |
+
network:
|
| 18 |
+
type: "lora"
|
| 19 |
+
linear: 16
|
| 20 |
+
linear_alpha: 16
|
| 21 |
+
save:
|
| 22 |
+
dtype: float16 # precision to save
|
| 23 |
+
save_every: 250 # save every this many steps
|
| 24 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 25 |
+
datasets:
|
| 26 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 27 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 28 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 29 |
+
# on windows, escape back slashes with another backslash so
|
| 30 |
+
# "C:\\path\\to\\images\\folder"
|
| 31 |
+
- folder_path: "/path/to/images/folder"
|
| 32 |
+
control_path: "/path/to/control/images/folder"
|
| 33 |
+
caption_ext: "txt"
|
| 34 |
+
# default_caption: "a person" # if caching text embeddings, if you don't have captions, this will get cached
|
| 35 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 36 |
+
resolution: [ 512, 768, 1024 ] # qwen image enjoys multiple resolutions
|
| 37 |
+
train:
|
| 38 |
+
batch_size: 1
|
| 39 |
+
# caching text embeddings is required for 32GB
|
| 40 |
+
cache_text_embeddings: true
|
| 41 |
+
|
| 42 |
+
steps: 3000 # total number of steps to train 500 - 4000 is a good range
|
| 43 |
+
gradient_accumulation: 1
|
| 44 |
+
timestep_type: "weighted"
|
| 45 |
+
train_unet: true
|
| 46 |
+
train_text_encoder: false # probably won't work with qwen image
|
| 47 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 48 |
+
noise_scheduler: "flowmatch" # for training only
|
| 49 |
+
optimizer: "adamw8bit"
|
| 50 |
+
lr: 1e-4
|
| 51 |
+
# uncomment this to skip the pre training sample
|
| 52 |
+
# skip_first_sample: true
|
| 53 |
+
# uncomment to completely disable sampling
|
| 54 |
+
# disable_sampling: true
|
| 55 |
+
dtype: bf16
|
| 56 |
+
model:
|
| 57 |
+
# huggingface model name or path
|
| 58 |
+
name_or_path: "Qwen/Qwen-Image-Edit"
|
| 59 |
+
arch: "qwen_image_edit"
|
| 60 |
+
quantize: true
|
| 61 |
+
# qtype_te: "qfloat8" Default float8 qquantization
|
| 62 |
+
# to use the ARA use the | pipe to point to hf path, or a local path if you have one.
|
| 63 |
+
# 3bit is required for 32GB
|
| 64 |
+
qtype: "uint3|qwen_image_edit_torchao_uint3.safetensors"
|
| 65 |
+
quantize_te: true
|
| 66 |
+
qtype_te: "qfloat8"
|
| 67 |
+
low_vram: true
|
| 68 |
+
sample:
|
| 69 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 70 |
+
sample_every: 250 # sample every this many steps
|
| 71 |
+
sample_start_step: 0 # start sampling at this step
|
| 72 |
+
width: 1024
|
| 73 |
+
height: 1024
|
| 74 |
+
samples:
|
| 75 |
+
- prompt: "do the thing to it"
|
| 76 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 77 |
+
- prompt: "do the thing to it"
|
| 78 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 79 |
+
- prompt: "do the thing to it"
|
| 80 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 81 |
+
- prompt: "do the thing to it"
|
| 82 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 83 |
+
- prompt: "do the thing to it"
|
| 84 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 85 |
+
- prompt: "do the thing to it"
|
| 86 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 87 |
+
- prompt: "do the thing to it"
|
| 88 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 89 |
+
- prompt: "do the thing to it"
|
| 90 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 91 |
+
- prompt: "do the thing to it"
|
| 92 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 93 |
+
- prompt: "do the thing to it"
|
| 94 |
+
ctrl_img: "/path/to/control/image.jpg"
|
| 95 |
+
neg: ""
|
| 96 |
+
seed: 42
|
| 97 |
+
walk_seed: true
|
| 98 |
+
guidance_scale: 3
|
| 99 |
+
sample_steps: 25
|
| 100 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 101 |
+
meta:
|
| 102 |
+
name: "[name]"
|
| 103 |
+
version: '1.0'
|
train_lora_sd35_large_24gb.yaml
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
# NOTE!! THIS IS CURRENTLY EXPERIMENTAL AND UNDER DEVELOPMENT. SOME THINGS WILL CHANGE
|
| 3 |
+
job: extension
|
| 4 |
+
config:
|
| 5 |
+
# this name will be the folder and filename name
|
| 6 |
+
name: "my_first_sd3l_lora_v1"
|
| 7 |
+
process:
|
| 8 |
+
- type: 'sd_trainer'
|
| 9 |
+
# root folder to save training sessions/samples/weights
|
| 10 |
+
training_folder: "output"
|
| 11 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 12 |
+
# performance_log_every: 1000
|
| 13 |
+
device: cuda:0
|
| 14 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 15 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 16 |
+
# trigger_word: "p3r5on"
|
| 17 |
+
network:
|
| 18 |
+
type: "lora"
|
| 19 |
+
linear: 16
|
| 20 |
+
linear_alpha: 16
|
| 21 |
+
save:
|
| 22 |
+
dtype: float16 # precision to save
|
| 23 |
+
save_every: 250 # save every this many steps
|
| 24 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 25 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 26 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 27 |
+
# hf_repo_id: your-username/your-model-slug
|
| 28 |
+
# hf_private: true #whether the repo is private or public
|
| 29 |
+
datasets:
|
| 30 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 31 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 32 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 33 |
+
# on windows, escape back slashes with another backslash so
|
| 34 |
+
# "C:\\path\\to\\images\\folder"
|
| 35 |
+
- folder_path: "/path/to/images/folder"
|
| 36 |
+
caption_ext: "txt"
|
| 37 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 38 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 39 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 40 |
+
resolution: [ 1024 ]
|
| 41 |
+
train:
|
| 42 |
+
batch_size: 1
|
| 43 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 44 |
+
gradient_accumulation_steps: 1
|
| 45 |
+
train_unet: true
|
| 46 |
+
train_text_encoder: false # May not fully work with SD3 yet
|
| 47 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 48 |
+
noise_scheduler: "flowmatch"
|
| 49 |
+
timestep_type: "linear" # linear or sigmoid
|
| 50 |
+
optimizer: "adamw8bit"
|
| 51 |
+
lr: 1e-4
|
| 52 |
+
# uncomment this to skip the pre training sample
|
| 53 |
+
# skip_first_sample: true
|
| 54 |
+
# uncomment to completely disable sampling
|
| 55 |
+
# disable_sampling: true
|
| 56 |
+
# uncomment to use new vell curved weighting. Experimental but may produce better results
|
| 57 |
+
# linear_timesteps: true
|
| 58 |
+
|
| 59 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on.
|
| 60 |
+
ema_config:
|
| 61 |
+
use_ema: true
|
| 62 |
+
ema_decay: 0.99
|
| 63 |
+
|
| 64 |
+
# will probably need this if gpu supports it for sd3, other dtypes may not work correctly
|
| 65 |
+
dtype: bf16
|
| 66 |
+
model:
|
| 67 |
+
# huggingface model name or path
|
| 68 |
+
name_or_path: "stabilityai/stable-diffusion-3.5-large"
|
| 69 |
+
is_v3: true
|
| 70 |
+
quantize: true # run 8bit mixed precision
|
| 71 |
+
sample:
|
| 72 |
+
sampler: "flowmatch" # must match train.noise_scheduler
|
| 73 |
+
sample_every: 250 # sample every this many steps
|
| 74 |
+
sample_start_step: 0 # start sampling at this step
|
| 75 |
+
width: 1024
|
| 76 |
+
height: 1024
|
| 77 |
+
prompts:
|
| 78 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 79 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 80 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 81 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 82 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 83 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 84 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 85 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 86 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 87 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 88 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 89 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 90 |
+
neg: ""
|
| 91 |
+
seed: 42
|
| 92 |
+
walk_seed: true
|
| 93 |
+
guidance_scale: 4
|
| 94 |
+
sample_steps: 25
|
| 95 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 96 |
+
meta:
|
| 97 |
+
name: "[name]"
|
| 98 |
+
version: '1.0'
|
train_lora_wan21_14b_24gb.yaml
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# IMPORTANT: The Wan2.1 14B model is huge. This config should work on 24GB GPUs. It cannot
|
| 2 |
+
# support keeping the text encoder on GPU while training with 24GB, so it is only good
|
| 3 |
+
# for training on a single prompt, for example a person with a trigger word.
|
| 4 |
+
# to train on captions, you need more vran for now.
|
| 5 |
+
---
|
| 6 |
+
job: extension
|
| 7 |
+
config:
|
| 8 |
+
# this name will be the folder and filename name
|
| 9 |
+
name: "my_first_wan21_14b_lora_v1"
|
| 10 |
+
process:
|
| 11 |
+
- type: 'sd_trainer'
|
| 12 |
+
# root folder to save training sessions/samples/weights
|
| 13 |
+
training_folder: "output"
|
| 14 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 15 |
+
# performance_log_every: 1000
|
| 16 |
+
device: cuda:0
|
| 17 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 18 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 19 |
+
# this is probably needed for 24GB cards when offloading TE to CPU
|
| 20 |
+
trigger_word: "p3r5on"
|
| 21 |
+
network:
|
| 22 |
+
type: "lora"
|
| 23 |
+
linear: 32
|
| 24 |
+
linear_alpha: 32
|
| 25 |
+
save:
|
| 26 |
+
dtype: float16 # precision to save
|
| 27 |
+
save_every: 250 # save every this many steps
|
| 28 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 29 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 30 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 31 |
+
# hf_repo_id: your-username/your-model-slug
|
| 32 |
+
# hf_private: true #whether the repo is private or public
|
| 33 |
+
datasets:
|
| 34 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 35 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 36 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 37 |
+
# on windows, escape back slashes with another backslash so
|
| 38 |
+
# "C:\\path\\to\\images\\folder"
|
| 39 |
+
# AI-Toolkit does not currently support video datasets, we will train on 1 frame at a time
|
| 40 |
+
# it works well for characters, but not as well for "actions"
|
| 41 |
+
- folder_path: "/path/to/images/folder"
|
| 42 |
+
caption_ext: "txt"
|
| 43 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 44 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 45 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 46 |
+
resolution: [ 632 ] # will be around 480p
|
| 47 |
+
train:
|
| 48 |
+
batch_size: 1
|
| 49 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 50 |
+
gradient_accumulation: 1
|
| 51 |
+
train_unet: true
|
| 52 |
+
train_text_encoder: false # probably won't work with wan
|
| 53 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 54 |
+
noise_scheduler: "flowmatch" # for training only
|
| 55 |
+
timestep_type: 'sigmoid'
|
| 56 |
+
optimizer: "adamw8bit"
|
| 57 |
+
lr: 1e-4
|
| 58 |
+
optimizer_params:
|
| 59 |
+
weight_decay: 1e-4
|
| 60 |
+
# uncomment this to skip the pre training sample
|
| 61 |
+
# skip_first_sample: true
|
| 62 |
+
# uncomment to completely disable sampling
|
| 63 |
+
# disable_sampling: true
|
| 64 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on.
|
| 65 |
+
ema_config:
|
| 66 |
+
use_ema: true
|
| 67 |
+
ema_decay: 0.99
|
| 68 |
+
dtype: bf16
|
| 69 |
+
# required for 24GB cards
|
| 70 |
+
# this will encode your trigger word and use those embeddings for every image in the dataset
|
| 71 |
+
unload_text_encoder: true
|
| 72 |
+
model:
|
| 73 |
+
# huggingface model name or path
|
| 74 |
+
name_or_path: "Wan-AI/Wan2.1-T2V-14B-Diffusers"
|
| 75 |
+
arch: 'wan21'
|
| 76 |
+
# these settings will save as much vram as possible
|
| 77 |
+
quantize: true
|
| 78 |
+
quantize_te: true
|
| 79 |
+
low_vram: true
|
| 80 |
+
sample:
|
| 81 |
+
sampler: "flowmatch"
|
| 82 |
+
sample_every: 250 # sample every this many steps
|
| 83 |
+
sample_start_step: 0 # start sampling at this step
|
| 84 |
+
width: 832
|
| 85 |
+
height: 480
|
| 86 |
+
num_frames: 40
|
| 87 |
+
fps: 15
|
| 88 |
+
# samples take a long time. so use them sparingly
|
| 89 |
+
# samples will be animated webp files, if you don't see them animated, open in a browser.
|
| 90 |
+
prompts:
|
| 91 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 92 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 93 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 94 |
+
neg: ""
|
| 95 |
+
seed: 42
|
| 96 |
+
walk_seed: true
|
| 97 |
+
guidance_scale: 5
|
| 98 |
+
sample_steps: 30
|
| 99 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 100 |
+
meta:
|
| 101 |
+
name: "[name]"
|
| 102 |
+
version: '1.0'
|
train_lora_wan21_1b_24gb.yaml
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
job: extension
|
| 3 |
+
config:
|
| 4 |
+
# this name will be the folder and filename name
|
| 5 |
+
name: "my_first_wan21_1b_lora_v1"
|
| 6 |
+
process:
|
| 7 |
+
- type: 'sd_trainer'
|
| 8 |
+
# root folder to save training sessions/samples/weights
|
| 9 |
+
training_folder: "output"
|
| 10 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 11 |
+
# performance_log_every: 1000
|
| 12 |
+
device: cuda:0
|
| 13 |
+
# if a trigger word is specified, it will be added to captions of training data if it does not already exist
|
| 14 |
+
# alternatively, in your captions you can add [trigger] and it will be replaced with the trigger word
|
| 15 |
+
# trigger_word: "p3r5on"
|
| 16 |
+
network:
|
| 17 |
+
type: "lora"
|
| 18 |
+
linear: 32
|
| 19 |
+
linear_alpha: 32
|
| 20 |
+
save:
|
| 21 |
+
dtype: float16 # precision to save
|
| 22 |
+
save_every: 250 # save every this many steps
|
| 23 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 24 |
+
push_to_hub: false #change this to True to push your trained model to Hugging Face.
|
| 25 |
+
# You can either set up a HF_TOKEN env variable or you'll be prompted to log-in
|
| 26 |
+
# hf_repo_id: your-username/your-model-slug
|
| 27 |
+
# hf_private: true #whether the repo is private or public
|
| 28 |
+
datasets:
|
| 29 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 30 |
+
# for instance image2.jpg and image2.txt. Only jpg, jpeg, and png are supported currently
|
| 31 |
+
# images will automatically be resized and bucketed into the resolution specified
|
| 32 |
+
# on windows, escape back slashes with another backslash so
|
| 33 |
+
# "C:\\path\\to\\images\\folder"
|
| 34 |
+
# AI-Toolkit does not currently support video datasets, we will train on 1 frame at a time
|
| 35 |
+
# it works well for characters, but not as well for "actions"
|
| 36 |
+
- folder_path: "/path/to/images/folder"
|
| 37 |
+
caption_ext: "txt"
|
| 38 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 39 |
+
shuffle_tokens: false # shuffle caption order, split by commas
|
| 40 |
+
cache_latents_to_disk: true # leave this true unless you know what you're doing
|
| 41 |
+
resolution: [ 632 ] # will be around 480p
|
| 42 |
+
train:
|
| 43 |
+
batch_size: 1
|
| 44 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 45 |
+
gradient_accumulation: 1
|
| 46 |
+
train_unet: true
|
| 47 |
+
train_text_encoder: false # probably won't work with wan
|
| 48 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 49 |
+
noise_scheduler: "flowmatch" # for training only
|
| 50 |
+
timestep_type: 'sigmoid'
|
| 51 |
+
optimizer: "adamw8bit"
|
| 52 |
+
lr: 1e-4
|
| 53 |
+
optimizer_params:
|
| 54 |
+
weight_decay: 1e-4
|
| 55 |
+
# uncomment this to skip the pre training sample
|
| 56 |
+
# skip_first_sample: true
|
| 57 |
+
# uncomment to completely disable sampling
|
| 58 |
+
# disable_sampling: true
|
| 59 |
+
# ema will smooth out learning, but could slow it down. Recommended to leave on.
|
| 60 |
+
ema_config:
|
| 61 |
+
use_ema: true
|
| 62 |
+
ema_decay: 0.99
|
| 63 |
+
dtype: bf16
|
| 64 |
+
model:
|
| 65 |
+
# huggingface model name or path
|
| 66 |
+
name_or_path: "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
|
| 67 |
+
arch: 'wan21'
|
| 68 |
+
quantize_te: true # saves vram
|
| 69 |
+
sample:
|
| 70 |
+
sampler: "flowmatch"
|
| 71 |
+
sample_every: 250 # sample every this many steps
|
| 72 |
+
sample_start_step: 0 # start sampling at this step
|
| 73 |
+
width: 832
|
| 74 |
+
height: 480
|
| 75 |
+
num_frames: 40
|
| 76 |
+
fps: 15
|
| 77 |
+
# samples take a long time. so use them sparingly
|
| 78 |
+
# samples will be animated webp files, if you don't see them animated, open in a browser.
|
| 79 |
+
prompts:
|
| 80 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 81 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 82 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 83 |
+
neg: ""
|
| 84 |
+
seed: 42
|
| 85 |
+
walk_seed: true
|
| 86 |
+
guidance_scale: 5
|
| 87 |
+
sample_steps: 30
|
| 88 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 89 |
+
meta:
|
| 90 |
+
name: "[name]"
|
| 91 |
+
version: '1.0'
|
train_lora_wan22_14b_24gb.yaml
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# this example focuses mainly for training Wan2.2 14b on images. It will work for video as well by increasing
|
| 2 |
+
# the number of frames in the dataset and samples. Training on and generating video is very VRAM intensive.
|
| 3 |
+
---
|
| 4 |
+
job: extension
|
| 5 |
+
config:
|
| 6 |
+
# this name will be the folder and filename name
|
| 7 |
+
name: "my_first_wan22_14b_lora_v1"
|
| 8 |
+
process:
|
| 9 |
+
- type: 'sd_trainer'
|
| 10 |
+
# root folder to save training sessions/samples/weights
|
| 11 |
+
training_folder: "output"
|
| 12 |
+
# uncomment to see performance stats in the terminal every N steps
|
| 13 |
+
# performance_log_every: 1000
|
| 14 |
+
device: cuda:0
|
| 15 |
+
# Use a trigger word if train.unload_text_encoder is true, however, if caching text embeddings, do not use a trigger word
|
| 16 |
+
# trigger_word: "p3r5on"
|
| 17 |
+
network:
|
| 18 |
+
type: "lora"
|
| 19 |
+
linear: 32
|
| 20 |
+
linear_alpha: 32
|
| 21 |
+
save:
|
| 22 |
+
dtype: float16 # precision to save
|
| 23 |
+
save_every: 250 # save every this many steps
|
| 24 |
+
max_step_saves_to_keep: 4 # how many intermittent saves to keep
|
| 25 |
+
datasets:
|
| 26 |
+
# datasets are a folder of images. captions need to be txt files with the same name as the image
|
| 27 |
+
# for instance image2.jpg and image2.txt.
|
| 28 |
+
# "C:\\path\\to\\images\\folder"
|
| 29 |
+
- folder_path: "/path/to/images/or/video/folder"
|
| 30 |
+
caption_ext: "txt"
|
| 31 |
+
caption_dropout_rate: 0.05 # will drop out the caption 5% of time
|
| 32 |
+
# number of frames to extract from your video. It will automatically extract them evenly spaced
|
| 33 |
+
# set to 1 frame for images
|
| 34 |
+
num_frames: 1
|
| 35 |
+
resolution: [ 512, 768, 1024]
|
| 36 |
+
train:
|
| 37 |
+
batch_size: 1
|
| 38 |
+
steps: 2000 # total number of steps to train 500 - 4000 is a good range
|
| 39 |
+
gradient_accumulation: 1
|
| 40 |
+
train_unet: true
|
| 41 |
+
train_text_encoder: false # probably won't work with wan
|
| 42 |
+
gradient_checkpointing: true # need the on unless you have a ton of vram
|
| 43 |
+
noise_scheduler: "flowmatch" # for training only
|
| 44 |
+
timestep_type: 'linear'
|
| 45 |
+
optimizer: "adamw8bit"
|
| 46 |
+
lr: 1e-4
|
| 47 |
+
optimizer_params:
|
| 48 |
+
weight_decay: 1e-4
|
| 49 |
+
# uncomment this to skip the pre training sample
|
| 50 |
+
# skip_first_sample: true
|
| 51 |
+
# uncomment to completely disable sampling
|
| 52 |
+
# disable_sampling: true
|
| 53 |
+
dtype: bf16
|
| 54 |
+
|
| 55 |
+
# IMPORTANT: this is for Wan 2.2 MOE. It will switch training one stage or the other every this many steps
|
| 56 |
+
switch_boundary_every: 10
|
| 57 |
+
|
| 58 |
+
# required for 24GB cards. You must do either unload_text_encoder or cache_text_embeddings but not both
|
| 59 |
+
|
| 60 |
+
# this will encode your trigger word and use those embeddings for every image in the dataset, captions will be ignored
|
| 61 |
+
# unload_text_encoder: true
|
| 62 |
+
|
| 63 |
+
# this will cache all captions in your dataset.
|
| 64 |
+
cache_text_embeddings: true
|
| 65 |
+
|
| 66 |
+
model:
|
| 67 |
+
# huggingface model name or path, this one if bf16, vs the float32 of the official repo
|
| 68 |
+
name_or_path: "ai-toolkit/Wan2.2-T2V-A14B-Diffusers-bf16"
|
| 69 |
+
arch: 'wan22_14b'
|
| 70 |
+
quantize: true
|
| 71 |
+
# This will pull and use a custom Accuracy Recovery Adapter to train at 4bit
|
| 72 |
+
qtype: "uint4|ostris/accuracy_recovery_adapters/wan22_14b_t2i_torchao_uint4.safetensors"
|
| 73 |
+
quantize_te: true
|
| 74 |
+
qtype_te: "qfloat8"
|
| 75 |
+
low_vram: true
|
| 76 |
+
model_kwargs:
|
| 77 |
+
# you can train high noise, low noise, or both. With low vram it will automatically unload the one not being trained.
|
| 78 |
+
train_high_noise: true
|
| 79 |
+
train_low_noise: true
|
| 80 |
+
sample:
|
| 81 |
+
sampler: "flowmatch"
|
| 82 |
+
sample_every: 250 # sample every this many steps
|
| 83 |
+
sample_start_step: 0 # start sampling at this step
|
| 84 |
+
width: 1024
|
| 85 |
+
height: 1024
|
| 86 |
+
# set to 1 for images
|
| 87 |
+
num_frames: 1
|
| 88 |
+
fps: 16
|
| 89 |
+
# samples take a long time. so use them sparingly
|
| 90 |
+
# samples will be animated webp files, if you don't see them animated, open in a browser.
|
| 91 |
+
prompts:
|
| 92 |
+
# you can add [trigger] to the prompts here and it will be replaced with the trigger word
|
| 93 |
+
# - "[trigger] holding a sign that says 'I LOVE PROMPTS!'"\
|
| 94 |
+
- "woman with red hair, playing chess at the park, bomb going off in the background"
|
| 95 |
+
- "a woman holding a coffee cup, in a beanie, sitting at a cafe"
|
| 96 |
+
- "a horse is a DJ at a night club, fish eye lens, smoke machine, lazer lights, holding a martini"
|
| 97 |
+
- "a man showing off his cool new t shirt at the beach, a shark is jumping out of the water in the background"
|
| 98 |
+
- "a bear building a log cabin in the snow covered mountains"
|
| 99 |
+
- "woman playing the guitar, on stage, singing a song, laser lights, punk rocker"
|
| 100 |
+
- "hipster man with a beard, building a chair, in a wood shop"
|
| 101 |
+
- "photo of a man, white background, medium shot, modeling clothing, studio lighting, white backdrop"
|
| 102 |
+
- "a man holding a sign that says, 'this is a sign'"
|
| 103 |
+
- "a bulldog, in a post apocalyptic world, with a shotgun, in a leather jacket, in a desert, with a motorcycle"
|
| 104 |
+
neg: ""
|
| 105 |
+
seed: 42
|
| 106 |
+
walk_seed: true
|
| 107 |
+
guidance_scale: 3.5
|
| 108 |
+
sample_steps: 25
|
| 109 |
+
# you can add any additional meta info here. [name] is replaced with config name at top
|
| 110 |
+
meta:
|
| 111 |
+
name: "[name]"
|
| 112 |
+
version: '1.0'
|
train_slider.example.yml
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
# This is in yaml format. You can use json if you prefer
|
| 3 |
+
# I like both but yaml is easier to write
|
| 4 |
+
# Plus it has comments which is nice for documentation
|
| 5 |
+
# This is the config I use on my sliders, It is solid and tested
|
| 6 |
+
job: train
|
| 7 |
+
config:
|
| 8 |
+
# the name will be used to create a folder in the output folder
|
| 9 |
+
# it will also replace any [name] token in the rest of this config
|
| 10 |
+
name: detail_slider_v1
|
| 11 |
+
# folder will be created with name above in folder below
|
| 12 |
+
# it can be relative to the project root or absolute
|
| 13 |
+
training_folder: "output/LoRA"
|
| 14 |
+
device: cuda:0 # cpu, cuda:0, etc
|
| 15 |
+
# for tensorboard logging, we will make a subfolder for this job
|
| 16 |
+
log_dir: "output/.tensorboard"
|
| 17 |
+
# you can stack processes for other jobs, It is not tested with sliders though
|
| 18 |
+
# just use one for now
|
| 19 |
+
process:
|
| 20 |
+
- type: slider # tells runner to run the slider process
|
| 21 |
+
# network is the LoRA network for a slider, I recommend to leave this be
|
| 22 |
+
network:
|
| 23 |
+
# network type lierla is traditional LoRA that works everywhere, only linear layers
|
| 24 |
+
type: "lierla"
|
| 25 |
+
# rank / dim of the network. Bigger is not always better. Especially for sliders. 8 is good
|
| 26 |
+
linear: 8
|
| 27 |
+
linear_alpha: 4 # Do about half of rank
|
| 28 |
+
# training config
|
| 29 |
+
train:
|
| 30 |
+
# this is also used in sampling. Stick with ddpm unless you know what you are doing
|
| 31 |
+
noise_scheduler: "ddpm" # or "ddpm", "lms", "euler_a"
|
| 32 |
+
# how many steps to train. More is not always better. I rarely go over 1000
|
| 33 |
+
steps: 500
|
| 34 |
+
# I have had good results with 4e-4 to 1e-4 at 500 steps
|
| 35 |
+
lr: 2e-4
|
| 36 |
+
# enables gradient checkpoint, saves vram, leave it on
|
| 37 |
+
gradient_checkpointing: true
|
| 38 |
+
# train the unet. I recommend leaving this true
|
| 39 |
+
train_unet: true
|
| 40 |
+
# train the text encoder. I don't recommend this unless you have a special use case
|
| 41 |
+
# for sliders we are adjusting representation of the concept (unet),
|
| 42 |
+
# not the description of it (text encoder)
|
| 43 |
+
train_text_encoder: false
|
| 44 |
+
# same as from sd-scripts, not fully tested but should speed up training
|
| 45 |
+
min_snr_gamma: 5.0
|
| 46 |
+
# just leave unless you know what you are doing
|
| 47 |
+
# also supports "dadaptation" but set lr to 1 if you use that,
|
| 48 |
+
# but it learns too fast and I don't recommend it
|
| 49 |
+
optimizer: "adamw"
|
| 50 |
+
# only constant for now
|
| 51 |
+
lr_scheduler: "constant"
|
| 52 |
+
# we randomly denoise random num of steps form 1 to this number
|
| 53 |
+
# while training. Just leave it
|
| 54 |
+
max_denoising_steps: 40
|
| 55 |
+
# works great at 1. I do 1 even with my 4090.
|
| 56 |
+
# higher may not work right with newer single batch stacking code anyway
|
| 57 |
+
batch_size: 1
|
| 58 |
+
# bf16 works best if your GPU supports it (modern)
|
| 59 |
+
dtype: bf16 # fp32, bf16, fp16
|
| 60 |
+
# if you have it, use it. It is faster and better
|
| 61 |
+
# torch 2.0 doesnt need xformers anymore, only use if you have lower version
|
| 62 |
+
# xformers: true
|
| 63 |
+
# I don't recommend using unless you are trying to make a darker lora. Then do 0.1 MAX
|
| 64 |
+
# although, the way we train sliders is comparative, so it probably won't work anyway
|
| 65 |
+
noise_offset: 0.0
|
| 66 |
+
# noise_offset: 0.0357 # SDXL was trained with offset of 0.0357. So use that when training on SDXL
|
| 67 |
+
|
| 68 |
+
# the model to train the LoRA network on
|
| 69 |
+
model:
|
| 70 |
+
# huggingface name, relative prom project path, or absolute path to .safetensors or .ckpt
|
| 71 |
+
name_or_path: "runwayml/stable-diffusion-v1-5"
|
| 72 |
+
is_v2: false # for v2 models
|
| 73 |
+
is_v_pred: false # for v-prediction models (most v2 models)
|
| 74 |
+
# has some issues with the dual text encoder and the way we train sliders
|
| 75 |
+
# it works bit weights need to probably be higher to see it.
|
| 76 |
+
is_xl: false # for SDXL models
|
| 77 |
+
|
| 78 |
+
# saving config
|
| 79 |
+
save:
|
| 80 |
+
dtype: float16 # precision to save. I recommend float16
|
| 81 |
+
save_every: 50 # save every this many steps
|
| 82 |
+
# this will remove step counts more than this number
|
| 83 |
+
# allows you to save more often in case of a crash without filling up your drive
|
| 84 |
+
max_step_saves_to_keep: 2
|
| 85 |
+
|
| 86 |
+
# sampling config
|
| 87 |
+
sample:
|
| 88 |
+
# must match train.noise_scheduler, this is not used here
|
| 89 |
+
# but may be in future and in other processes
|
| 90 |
+
sampler: "ddpm"
|
| 91 |
+
# sample every this many steps
|
| 92 |
+
sample_every: 20
|
| 93 |
+
# image size
|
| 94 |
+
width: 512
|
| 95 |
+
height: 512
|
| 96 |
+
# prompts to use for sampling. Do as many as you want, but it slows down training
|
| 97 |
+
# pick ones that will best represent the concept you are trying to adjust
|
| 98 |
+
# allows some flags after the prompt
|
| 99 |
+
# --m [number] # network multiplier. LoRA weight. -3 for the negative slide, 3 for the positive
|
| 100 |
+
# slide are good tests. will inherit sample.network_multiplier if not set
|
| 101 |
+
# --n [string] # negative prompt, will inherit sample.neg if not set
|
| 102 |
+
# Only 75 tokens allowed currently
|
| 103 |
+
# I like to do a wide positive and negative spread so I can see a good range and stop
|
| 104 |
+
# early if the network is braking down
|
| 105 |
+
prompts:
|
| 106 |
+
- "a woman in a coffee shop, black hat, blonde hair, blue jacket --m -5"
|
| 107 |
+
- "a woman in a coffee shop, black hat, blonde hair, blue jacket --m -3"
|
| 108 |
+
- "a woman in a coffee shop, black hat, blonde hair, blue jacket --m 3"
|
| 109 |
+
- "a woman in a coffee shop, black hat, blonde hair, blue jacket --m 5"
|
| 110 |
+
- "a golden retriever sitting on a leather couch, --m -5"
|
| 111 |
+
- "a golden retriever sitting on a leather couch --m -3"
|
| 112 |
+
- "a golden retriever sitting on a leather couch --m 3"
|
| 113 |
+
- "a golden retriever sitting on a leather couch --m 5"
|
| 114 |
+
- "a man with a beard and red flannel shirt, wearing vr goggles, walking into traffic --m -5"
|
| 115 |
+
- "a man with a beard and red flannel shirt, wearing vr goggles, walking into traffic --m -3"
|
| 116 |
+
- "a man with a beard and red flannel shirt, wearing vr goggles, walking into traffic --m 3"
|
| 117 |
+
- "a man with a beard and red flannel shirt, wearing vr goggles, walking into traffic --m 5"
|
| 118 |
+
# negative prompt used on all prompts above as default if they don't have one
|
| 119 |
+
neg: "cartoon, fake, drawing, illustration, cgi, animated, anime, monochrome"
|
| 120 |
+
# seed for sampling. 42 is the answer for everything
|
| 121 |
+
seed: 42
|
| 122 |
+
# walks the seed so s1 is 42, s2 is 43, s3 is 44, etc
|
| 123 |
+
# will start over on next sample_every so s1 is always seed
|
| 124 |
+
# works well if you use same prompt but want different results
|
| 125 |
+
walk_seed: false
|
| 126 |
+
# cfg scale (4 to 10 is good)
|
| 127 |
+
guidance_scale: 7
|
| 128 |
+
# sampler steps (20 to 30 is good)
|
| 129 |
+
sample_steps: 20
|
| 130 |
+
# default network multiplier for all prompts
|
| 131 |
+
# since we are training a slider, I recommend overriding this with --m [number]
|
| 132 |
+
# in the prompts above to get both sides of the slider
|
| 133 |
+
network_multiplier: 1.0
|
| 134 |
+
|
| 135 |
+
# logging information
|
| 136 |
+
logging:
|
| 137 |
+
log_every: 10 # log every this many steps
|
| 138 |
+
use_wandb: false # not supported yet
|
| 139 |
+
verbose: false # probably done need unless you are debugging
|
| 140 |
+
|
| 141 |
+
# slider training config, best for last
|
| 142 |
+
slider:
|
| 143 |
+
# resolutions to train on. [ width, height ]. This is less important for sliders
|
| 144 |
+
# as we are not teaching the model anything it doesn't already know
|
| 145 |
+
# but must be a size it understands [ 512, 512 ] for sd_v1.5 and [ 768, 768 ] for sd_v2.1
|
| 146 |
+
# and [ 1024, 1024 ] for sd_xl
|
| 147 |
+
# you can do as many as you want here
|
| 148 |
+
resolutions:
|
| 149 |
+
- [ 512, 512 ]
|
| 150 |
+
# - [ 512, 768 ]
|
| 151 |
+
# - [ 768, 768 ]
|
| 152 |
+
# slider training uses 4 combined steps for a single round. This will do it in one gradient
|
| 153 |
+
# step. It is highly optimized and shouldn't take anymore vram than doing without it,
|
| 154 |
+
# since we break down batches for gradient accumulation now. so just leave it on.
|
| 155 |
+
batch_full_slide: true
|
| 156 |
+
# These are the concepts to train on. You can do as many as you want here,
|
| 157 |
+
# but they can conflict outweigh each other. Other than experimenting, I recommend
|
| 158 |
+
# just doing one for good results
|
| 159 |
+
targets:
|
| 160 |
+
# target_class is the base concept we are adjusting the representation of
|
| 161 |
+
# for example, if we are adjusting the representation of a person, we would use "person"
|
| 162 |
+
# if we are adjusting the representation of a cat, we would use "cat" It is not
|
| 163 |
+
# a keyword necessarily but what the model understands the concept to represent.
|
| 164 |
+
# "person" will affect men, women, children, etc but will not affect cats, dogs, etc
|
| 165 |
+
# it is the models base general understanding of the concept and everything it represents
|
| 166 |
+
# you can leave it blank to affect everything. In this example, we are adjusting
|
| 167 |
+
# detail, so we will leave it blank to affect everything
|
| 168 |
+
- target_class: ""
|
| 169 |
+
# positive is the prompt for the positive side of the slider.
|
| 170 |
+
# It is the concept that will be excited and amplified in the model when we slide the slider
|
| 171 |
+
# to the positive side and forgotten / inverted when we slide
|
| 172 |
+
# the slider to the negative side. It is generally best to include the target_class in
|
| 173 |
+
# the prompt. You want it to be the extreme of what you want to train on. For example,
|
| 174 |
+
# if you want to train on fat people, you would use "an extremely fat, morbidly obese person"
|
| 175 |
+
# as the prompt. Not just "fat person"
|
| 176 |
+
# max 75 tokens for now
|
| 177 |
+
positive: "high detail, 8k, intricate, detailed, high resolution, high res, high quality"
|
| 178 |
+
# negative is the prompt for the negative side of the slider and works the same as positive
|
| 179 |
+
# it does not necessarily work the same as a negative prompt when generating images
|
| 180 |
+
# these need to be polar opposites.
|
| 181 |
+
# max 76 tokens for now
|
| 182 |
+
negative: "blurry, boring, fuzzy, low detail, low resolution, low res, low quality"
|
| 183 |
+
# the loss for this target is multiplied by this number.
|
| 184 |
+
# if you are doing more than one target it may be good to set less important ones
|
| 185 |
+
# to a lower number like 0.1 so they don't outweigh the primary target
|
| 186 |
+
weight: 1.0
|
| 187 |
+
# shuffle the prompts split by the comma. We will run every combination randomly
|
| 188 |
+
# this will make the LoRA more robust. You probably want this on unless prompt order
|
| 189 |
+
# is important for some reason
|
| 190 |
+
shuffle: true
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
# anchors are prompts that we will try to hold on to while training the slider
|
| 194 |
+
# these are NOT necessary and can prevent the slider from converging if not done right
|
| 195 |
+
# leave them off if you are having issues, but they can help lock the network
|
| 196 |
+
# on certain concepts to help prevent catastrophic forgetting
|
| 197 |
+
# you want these to generate an image that is not your target_class, but close to it
|
| 198 |
+
# is fine as long as it does not directly overlap it.
|
| 199 |
+
# For example, if you are training on a person smiling,
|
| 200 |
+
# you could use "a person with a face mask" as an anchor. It is a person, the image is the same
|
| 201 |
+
# regardless if they are smiling or not, however, the closer the concept is to the target_class
|
| 202 |
+
# the less the multiplier needs to be. Keep multipliers less than 1.0 for anchors usually
|
| 203 |
+
# for close concepts, you want to be closer to 0.1 or 0.2
|
| 204 |
+
# these will slow down training. I am leaving them off for the demo
|
| 205 |
+
|
| 206 |
+
# anchors:
|
| 207 |
+
# - prompt: "a woman"
|
| 208 |
+
# neg_prompt: "animal"
|
| 209 |
+
# # the multiplier applied to the LoRA when this is run.
|
| 210 |
+
# # higher will give it more weight but also help keep the lora from collapsing
|
| 211 |
+
# multiplier: 1.0
|
| 212 |
+
# - prompt: "a man"
|
| 213 |
+
# neg_prompt: "animal"
|
| 214 |
+
# multiplier: 1.0
|
| 215 |
+
# - prompt: "a person"
|
| 216 |
+
# neg_prompt: "animal"
|
| 217 |
+
# multiplier: 1.0
|
| 218 |
+
|
| 219 |
+
# You can put any information you want here, and it will be saved in the model.
|
| 220 |
+
# The below is an example, but you can put your grocery list in it if you want.
|
| 221 |
+
# It is saved in the model so be aware of that. The software will include this
|
| 222 |
+
# plus some other information for you automatically
|
| 223 |
+
meta:
|
| 224 |
+
# [name] gets replaced with the name above
|
| 225 |
+
name: "[name]"
|
| 226 |
+
# version: '1.0'
|
| 227 |
+
# creator:
|
| 228 |
+
# name: Your Name
|
| 229 |
+
# email: your@gmail.com
|
| 230 |
+
# website: https://your.website
|