Kohya-ss-gui v25.0.3 训练Flux.1 大模型命令参数
本文是博主的训练笔记,这篇是记录训练Flux.1大模型的命令行参数:
-
数据结构
/app/data/Flux大模型/train/img . └── 10_skm qili ├── 10x4096_4096x4096_flux.npz ├── 10x4096.jpg ├── 10x4096.txt ├── 11x4096_4096x4096_flux.npz ├── 11x4096.jpg ├── 11x4096.txt ├── 12x4096_4096x4096_flux.npz ├── 12x4096.jpg ├── 12x4096.txt ├── 13x4096_4096x4096_flux.npz ├── 13x4096.jpg ├── 13x4096.txt ├── 14x4096_4096x4096_flux.npz
-
训练命令
python /
app/sd-scripts/flux_train.py --config_file /app/outputs/config_dreambooth.toml
- 编辑配置文件
vim config_dreambooth.toml
写入以下内容:
adaptive_noise_scale = 0
ae = "/app/models/vae/ae.safetensors"
blocks_to_swap = 0
bucket_no_upscale = true
bucket_reso_steps = 64
cache_latents = true
cache_latents_to_disk = true
cache_text_encoder_outputs = true
cache_text_encoder_outputs_to_disk = true
caption_dropout_every_n_epochs = 0
caption_dropout_rate = 0
caption_extension = ".txt"
clip_l = "/app/models/clip/clip_l.safetensors"
clip_skip = 1
discrete_flow_shift = 3.1582
double_blocks_to_swap = 0
dynamo_backend = "no"
enable_bucket = true
epoch = 5
fused_backward_pass = true
gradient_accumulation_steps = 1
gradient_checkpointing = true
guidance_scale = 1
huber_c = 0.1
huber_scale = 1
huber_schedule = "snr"
keep_tokens = 0
learning_rate = 5e-5
learning_rate_te = 0
logging_dir = "/app/logs"
loss_type = "l2"
lr_scheduler = "constant_with_warmup"
lr_scheduler_args = []
lr_scheduler_num_cycles = 1
lr_scheduler_power = 1
lr_warmup_steps = 0.1
max_bucket_reso = 2048
max_data_loader_n_workers = 0
max_timestep = 1000
max_token_length = 75
max_train_epochs = 10
max_train_steps = 16000000
min_bucket_reso = 256
mixed_precision = "bf16"
model_prediction_type = "raw"
multires_noise_discount = 0.3
multires_noise_iterations = 0
noise_offset = 0
noise_offset_type = "Original"
optimizer_args = [ "relative_step=False", "scale_parameter=False", "warmup_init=False",]
optimizer_type = "Adafactor"
output_dir = "/app/outputs"
output_name = "国风大模型"
persistent_data_loader_workers = 0
pretrained_model_name_or_path = "/app/models/unet/flux1-dev.safetensors"
prior_loss_weight = 1
resolution = "1024,1024"
sample_prompts = "/app/outputs/sample/prompt.txt"
sample_sampler = "euler_a"
save_every_n_epochs = 1
save_model_as = "safetensors"
save_precision = "bf16"
sdpa = true
seed = 12345
single_blocks_to_swap = 0
t5xxl = "/app/models/clip/t5xxl_fp16.safetensors"
t5xxl_max_token_length = 512
timestep_sampling = "shift"
train_batch_size = 8
train_blocks = "all"
train_data_dir = "/app/data/Flux大模型/train/img"
wandb_run_name = "国风大模型"