bmaltais / kohya_ss

Apache License 2.0
9.53k stars 1.23k forks source link

Dreambooth Error [FLUX] #2889

Closed Crimsonfart closed 1 week ago

Crimsonfart commented 1 week ago

I saw in a YouTube tutorial that you can check "Flux" under Model. But I don't have an option to tick Flux. (Only V2, v_parameterization, SDXL) Could the error possibly have something to do with that? I have installed the latest version. Thanks for the help.

I get the following error: KeyError: 'time_embed.0.weight'

22:13:00-928529 INFO     Start training Dreambooth...
22:13:00-929528 INFO     Validating lr scheduler arguments...
22:13:00-930528 INFO     Validating optimizer arguments...
22:13:00-930528 INFO     Validating C:/AI/outputdream existence and writability... SUCCESS
22:13:00-931527 INFO     Validating
                         C:/pinokio/api/stable-diffusion-webui-forge.git/app/models/Stable-diffusion/flux1-dev.safetenso
                         rs existence... SUCCESS
22:13:00-932528 INFO     Validating C:/AI/training_directory/img existence... SUCCESS
22:13:00-932528 INFO     Folder 40_shs woman: 40 repeats found
22:13:00-933530 INFO     Folder 40_shs woman: 19 images found
22:13:00-934528 INFO     Folder 40_shs woman: 19 * 40 = 760 steps
22:13:00-935529 INFO     Regulatization factor: 1
22:13:00-935529 INFO     Total steps: 760
22:13:00-936528 INFO     Train batch size: 1
22:13:00-936528 INFO     Gradient accumulation steps: 1
22:13:00-937527 INFO     Epoch: 1
22:13:00-937527 INFO     Max train steps: 1600
22:13:00-938529 INFO     lr_warmup_steps = 160
22:13:00-939528 INFO     Saving training config to C:/AI/outputdream\last_20241008-221300.json...
22:13:00-941529 INFO     Executing command: C:\AI\koja\kohya_ss\venv\Scripts\accelerate.EXE launch --dynamo_backend no
                         --dynamo_mode default --mixed_precision no --num_processes 1 --num_machines 1
                         --num_cpu_threads_per_process 2 C:/AI/koja/kohya_ss/sd-scripts/train_db.py --config_file
                         C:/AI/outputdream/config_dreambooth-20241008-221300.toml
22:13:00-943528 INFO     Command executed.
2024-10-08 22:13:07 INFO     Loading settings from                                                    train_util.py:4174
                             C:/AI/outputdream/config_dreambooth-20241008-221300.toml...
                    INFO     C:/AI/outputdream/config_dreambooth-20241008-221300                      train_util.py:4193
2024-10-08 22:13:07 INFO     prepare tokenizer                                                        train_util.py:4665
                    INFO     update token length: 75                                                  train_util.py:4682
                    INFO     prepare images.                                                          train_util.py:1815
                    INFO     found directory C:\AI\training_directory\img\40_shs woman contains 19    train_util.py:1762
                             image files
                    INFO     760 train images with repeating.                                         train_util.py:1856
                    INFO     0 reg images.                                                            train_util.py:1859
                    WARNING  no regularization images / 正則化画像が見つかりませんでした              train_util.py:1864
                    INFO     [Dataset 0]                                                              config_util.py:572
                               batch_size: 1
                               resolution: (512, 512)
                               enable_bucket: True
                               network_multiplier: 1.0
                               min_bucket_reso: 256
                               max_bucket_reso: 2048
                               bucket_reso_steps: 64
                               bucket_no_upscale: True

                               [Subset 0 of Dataset 0]
                                 image_dir: "C:\AI\training_directory\img\40_shs woman"
                                 image_count: 19
                                 num_repeats: 40
                                 shuffle_caption: False
                                 keep_tokens: 0
                                 keep_tokens_separator:
                                 caption_separator: ,
                                 secondary_separator: None
                                 enable_wildcard: False
                                 caption_dropout_rate: 0.0
                                 caption_dropout_every_n_epoches: 0
                                 caption_tag_dropout_rate: 0.0
                                 caption_prefix: None
                                 caption_suffix: None
                                 color_aug: False
                                 flip_aug: False
                                 face_crop_aug_range: None
                                 random_crop: False
                                 token_warmup_min: 1,
                                 token_warmup_step: 0,
                                 alpha_mask: False,
                                 is_reg: False
                                 class_tokens: shs woman
                                 caption_extension: .txt

                    INFO     [Dataset 0]                                                              config_util.py:578
                    INFO     loading image sizes.                                                      train_util.py:911
100%|█████████████████████████████████████████████████████████████████████████████████| 19/19 [00:00<00:00, 517.46it/s]
                    INFO     make buckets                                                              train_util.py:917
                    WARNING  min_bucket_reso and max_bucket_reso are ignored if bucket_no_upscale is   train_util.py:934
                             set, because bucket reso is defined by image size automatically /
                             bucket_no_upscaleが指定された場合は、bucketの解像度は画像サイズから自動計
                             算されるため、min_bucket_resoとmax_bucket_resoは無視されます
                    INFO     number of images (including repeats) /                                    train_util.py:963
                             各bucketの画像枚数(繰り返し回数を含む)
                    INFO     bucket 0: resolution (320, 768), count: 40                                train_util.py:968
                    INFO     bucket 1: resolution (384, 384), count: 40                                train_util.py:968
                    INFO     bucket 2: resolution (384, 576), count: 40                                train_util.py:968
                    INFO     bucket 3: resolution (448, 448), count: 160                               train_util.py:968
                    INFO     bucket 4: resolution (512, 512), count: 480                               train_util.py:968
                    INFO     mean ar error (without repeats): 0.0038937599676761698                    train_util.py:973
                    INFO     prepare accelerator                                                         train_db.py:106
accelerator device: cuda
                    INFO     loading model for process 0/1                                            train_util.py:4823
                    INFO     load StableDiffusion checkpoint:                                         train_util.py:4779
                             C:/pinokio/api/stable-diffusion-webui-forge.git/app/models/Stable-diffus
                             ion/flux1-dev.safetensors
Traceback (most recent call last):
  File "C:\AI\koja\kohya_ss\sd-scripts\train_db.py", line 529, in <module>
    train(args)
  File "C:\AI\koja\kohya_ss\sd-scripts\train_db.py", line 123, in train
    text_encoder, vae, unet, load_stable_diffusion_format = train_util.load_target_model(args, weight_dtype, accelerator)
  File "C:\AI\koja\kohya_ss\sd-scripts\library\train_util.py", line 4825, in load_target_model
    text_encoder, vae, unet, load_stable_diffusion_format = _load_target_model(
  File "C:\AI\koja\kohya_ss\sd-scripts\library\train_util.py", line 4780, in _load_target_model
    text_encoder, vae, unet = model_util.load_models_from_stable_diffusion_checkpoint(
  File "C:\AI\koja\kohya_ss\sd-scripts\library\model_util.py", line 1005, in load_models_from_stable_diffusion_checkpoint
    converted_unet_checkpoint = convert_ldm_unet_checkpoint(v2, state_dict, unet_config)
  File "C:\AI\koja\kohya_ss\sd-scripts\library\model_util.py", line 267, in convert_ldm_unet_checkpoint
    new_checkpoint["time_embedding.linear_1.weight"] = unet_state_dict["time_embed.0.weight"]
KeyError: 'time_embed.0.weight'
Traceback (most recent call last):
  File "C:\Users\****\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\****\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\AI\koja\kohya_ss\venv\Scripts\accelerate.EXE\__main__.py", line 7, in <module>
  File "C:\AI\koja\kohya_ss\venv\lib\site-packages\accelerate\commands\accelerate_cli.py", line 47, in main
    args.func(args)
  File "C:\AI\koja\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 1017, in launch_command
    simple_launcher(args)
  File "C:\AI\koja\kohya_ss\venv\lib\site-packages\accelerate\commands\launch.py", line 637, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['C:\\AI\\koja\\kohya_ss\\venv\\Scripts\\python.exe', 'C:/AI/koja/kohya_ss/sd-scripts/train_db.py', '--config_file', 'C:/AI/outputdream/config_dreambooth-20241008-221300.toml']' returned non-zero exit status 1.
22:13:09-148010 INFO     Training has ended.
grider-withourai commented 1 week ago

May I know how you solved this, please?