kohya-ss / sd-scripts

Apache License 2.0
5.2k stars 862 forks source link

Flux Schnell lora size is too small (1.42 MB) and Does not generate images of the character that it was trained on. #1566

Open Hassan-jr opened 1 month ago

Hassan-jr commented 1 month ago

I trained a custom character model using flux schnell, that training was success however the resulting lora is too small (1.42mb). And When I use that lora on the minimal inference I get totally different character that is not even close. My training dataset are well prepared and captioned well. Here are my configurations:

Config.toml:

pretrained_model_name_or_path = "/teamspace/studios/this_studio/kohya_ss/base/flux1-schnell.safetensors"
clip_l = "/teamspace/studios/this_studio/kohya_ss/base/clip_l.safetensors"
t5xxl = "/teamspace/studios/this_studio/kohya_ss/base/t5xxl_fp16.safetensors"
ae = "/teamspace/studios/this_studio/kohya_ss/base/ae.safetensors"
caption_extension = ".txt"
resolution = "1024,1024"
cache_latents = true
enable_bucket = true
bucket_no_upscale = true
output_dir = "/teamspace/studios/this_studio/kohya_ss/sd-scripts/trainings/model"
output_name = "w3r4jman"
save_precision = "bf16"
save_every_n_epochs = 1
train_batch_size = 2
max_token_length = 225
xformers = true
max_train_epochs = 10
persistent_data_loader_workers = true
gradient_checkpointing = true
mixed_precision = "bf16"
logging_dir = "/teamspace/studios/this_studio/kohya_ss/sd-scripts/trainings/log"
sample_every_n_epochs = 1
sample_prompts = "/teamspace/studios/this_studio/kohya_ss/sd-scripts/trainings/prompt.txt"
sample_sampler = "euler_a"
optimizer_type = "AdamW8bit"
learning_rate = 0.0001
lr_scheduler = "cosine_with_restarts"
lr_warmup_steps = 500
lr_scheduler_num_cycles = 3
dataset_config = "/teamspace/studios/this_studio/kohya_ss/sd-scripts/trainings/dataset_config.toml"
unet_lr = 0.0001
text_encoder_lr = 5e-5
network_module = "networks.lora"
network_dim = 8
network_alpha = 1

dataset_config.toml:

[[datasets]]
  [[datasets.subsets]]
  image_dir = '/teamspace/studios/this_studio/kohya_ss/sd-scripts/trainings/img'
  caption_extension = '.txt'
  class_tokens = 'w3r4jman'
  num_repeats = 30

When I trained on sdxl base model on the same dataset and config, I got a lora size 57mb and that works good. So where is the problem in this case, can someone help me.

kohya-ss commented 1 month ago

Unfortunately, schnell is not supported yet.

Hassan-jr commented 1 month ago

I hope it will be supported in the near future. Thanks

JoshonSmith commented 1 month ago

will flux-schnell be supported in the near future?