Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SD3.5LのLoraで複数概念が学習できない。 #1802

Open
waomodder opened this issue Nov 21, 2024 · 21 comments
Open

SD3.5LのLoraで複数概念が学習できない。 #1802

waomodder opened this issue Nov 21, 2024 · 21 comments

Comments

@waomodder
Copy link

いつも開発お疲れ様です。
今回はSD3.5Lで複数概念が全く学習されなかったのでバグ報告させていただきます。

私はいままで10以上の概念を持つLoraをSD1.5やSDXLで学習させて作成した経験があります。
今回も同じようにSD3.5Lで10以上の概念を学習させようと何度もテストしましたが、まったくうまくいきません。

そこで試しに4つの概念を同時に学習させてちゃんと学習内容が反映されているかテストを行いました。

トークンはそれぞれ、「A-RRS」、「FRS」、「MRS」、「SRS」で、それぞれのフォルダには同じデザインのキャラクターの画像が50枚入っています。
各キャラクターは上半身、全体像、顔のアップ、立ち姿、ポージングといった画像となっています。
image

下が教師画像の例です。

A-RRS
0052

FRS
0214

MRS
0013

SRS
0169

ところが、ComfyUIで生成したところ、結果は全く持って似ても似つかないものとなってしまいました。
image
image
image
こちらはsd-scriptsで生成されたもの
srdmk3_MC_t2_001000_00_20241121215524_1

テストした際のコマンドはこちらとなります。
accelerate launch --num_cpu_threads_per_process=20 sd3_train_network.py --network_module networks.lora_sd3 --network_args "train_t5xxl=True" --fp8_base --mixed_precision "bf16" --highvram --bucket_reso_steps=64 --caption_extension=".txt" --enable_bucket --min_bucket_reso=256 --max_bucket_reso=2048 --max_data_loader_n_workers="4" --max_grad_norm="1" --max_timestep="1000" --resolution="1024,1024" --optimizer_type "adamwschedulefree" --optimizer_args "weight_decay=0.01" "betas=0.9,0.999" "eps=0.000001" --unet_lr="3e-4" --text_encoder_lr 3e-4 1e-5 1e-6 --output_name="srdmk3_MC_t2" --output_dir="D:\Lora_learning\Data\output" --pretrained_model_name_or_path="D:\ComfyUI_windows_portable\ComfyUI\models\checkpoints\sd3.5_large.safetensors" --save_every_n_epochs="1" --save_model_as=safetensors --save_precision="bf16" --train_batch_size="1" --train_data_dir="D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test" --sdpa --gradient_checkpointing --max_train_epochs=2 --network_dim 64 --network_alpha 32.0 --save_every_n_epochs 1 --save_every_n_steps 1000 --bucket_no_upscale --clip_l="D:\ComfyUI_windows_portable\ComfyUI\models\clip\clip_l.safetensors" --clip_g="D:\ComfyUI_windows_portable\ComfyUI\models\clip\clip_g.safetensors" --t5xxl="D:\ComfyUI_windows_portable\ComfyUI\models\clip\t5xxl_fp16.safetensors" --save_every_n_epochs=1 --sample_every_n_steps 1000 --sample_prompts "D:\Lora_learning\Data\output\prompt.txt" --sample_sampler 'k_euler' --weighting_scheme uniform --training_shift 1.0 --apply_t5_attn_mask --bucket_no_upscale --bucket_reso_steps="64" --cache_latents --cache_latents_to_disk --clip_skip="0" --dynamo_backend="eager" --gradient_checkpointing --huber_c="0.1" --huber_schedule="snr" --ip_noise_gamma="0.1" --ip_noise_gamma_random_strength --loss_type="l2" --noise_offset="0.0" --persistent_data_loader_workers --prior_loss_weight="1" --sdpa

TEも含めてちゃんと学習させているはずなんですが全く教師画像に似ておらず、どうすればいいのか手詰まりの状況です。
ちゃんとTEが学習されているはずならSDXLのように分けて学習してくれるはずだと思いますので、何かしらバグがあった際には修正をしていただけるでしょうか。よろしくお願いいたします。

@kohya-ss
Copy link
Owner

複数概念が学習できない報告は私もいくつか拝見しております。Text EncoderのLoRAの学習については改めて確認してみます。とりあえずComfyUI等で、CLIP(T5XXL)のLoRA適用率を0にして、画像が変化するかお試しいただけますでしょうか。もし画像が変化しないなら、学習できていない可能性が高いと思われます。

@waomodder
Copy link
Author

早速ComfyUIでLoraのTEを0にして生成しました。
image

結果は全く似てませんでした・・。
image
image
image

@kohya-ss
Copy link
Owner

以前FLUX.1で複数キャラクタをひとつのLoRAに学ばせることができたのを思い出し、SD3.5Lでも試してみました。
結果として、学習不足もあり品質は悪いものの一応出し分けることができました。Text Encoderは学習せずDiTのみです。

image

プロンプトはThe illustration depicts a young girl named kagasaka sonoha wearing a traditional Japanese sailor school uniform, standing at a bus stop on a rainy day. ~~~The illustration depicts a young girl named ichijo tsumugi wearing a traditional Japanese sailor school uniform, standing at a bus stop on a rainy day. ~~~です。

教師データは100枚程度で、一例として、以下のような画像に、自然言語を用い(Florence-2で生成)、young girl named kagasaka sonohayoung girl named ichijo tsumugiのようにキャラ名を指定したプロンプトで学習しています。

image

左:The image is an illustration of a young girl named kagasaka sonoha in a classroom. She is standing in front of a desk with her arms crossed and is wearing a white blouse with a black bow tie and a black skirt. The girl is smiling and looking directly at the camera. The classroom has rows of desks and chairs, and there are large windows on the far wall. The overall color scheme of the image is bright and cheerful.

右:The image shows a young girl named ichijo tsumugi standing in a classroom. She is wearing a white blouse with a blue tie and a black skirt. She has a serious expression on her face and is looking directly at the camera. The classroom has rows of desks and chairs, and there is a green chalkboard on the wall behind her. The floor is tiled and there are windows on the left side of the image.

ですので、もしかするとキーワードでは反応が悪く、自然言語の方が効果的なのかもしれません。試しに自然言語で、「○○という名前のロボットの白背景のイラスト」(たとえばA detailed illustration of a robot named XXXX, on a white background.のような感じでしょうか)のようなキャプションで学習、生成してみていただけますでしょうか。

@waomodder
Copy link
Author

早速の対応ありがとうございます。
一応、自分は教師データのキャプションは以下の通りで自然言語ではなく最低限のダンボールタグ形式のキャプションを付けております。

A-RRS, mecha, robot, weapon, solo, stocky legs, holding, looking at viewer

一度、DiTのみでの学習を行い、それでもだめであれば自然言語キャプションを付けて学習させてみます。
結果が出るまで少しお待ちくださいませ。

@waomodder
Copy link
Author

今更ですが、一つご質問があります。DiTだけ学習させる場合は--network_train_unet_onlyを付ければいいんでしょうか?
何故か画像のように学習時にテキストエンコーダーが有効になってしまいます。
accelerate launch --mixed_precision bf16 --num_cpu_threads_per_process 3 sd3_train_network.py --pretrained_model_name_or_path="D:\ComfyUI_windows_portable\ComfyUI\models\checkpoints\sd3.5_large.safetensors" --clip_l="D:\ComfyUI_windows_portable\ComfyUI\models\clip\clip_l.safetensors" --clip_g="D:\ComfyUI_windows_portable\ComfyUI\models\clip\clip_g.safetensors" --t5xxl="D:\ComfyUI_windows_portable\ComfyUI\models\clip\t5xxl_fp16.safetensors" --cache_latents_to_disk --save_model_as safetensors --sdpa --persistent_data_loader_workers --max_data_loader_n_workers 2 --seed 42 --gradient_checkpointing --mixed_precision bf16 --save_precision bf16 --network_module networks.lora_sd3 --network_dim 32 --network_train_unet_only --optimizer_type adamw8bit --learning_rate 1e-4 --cache_text_encoder_outputs --cache_text_encoder_outputs_to_disk --fp8_base --highvram --max_train_epochs 2 --resolution="1024,1024" --save_every_n_epochs 1 --train_data_dir="D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test" --output_dir="D:\Lora_learning\Data\output" --output_name="srdmk3_v05t7_6" --save_every_n_epochs 1 --save_every_n_steps 1000 --sample_every_n_steps 1000 --sample_prompts "D:\Lora_learning\Data\output\prompt.txt" --sample_sampler 'k_euler' --caption_extension=".txt"

image

@waomodder
Copy link
Author

@kohya-ss
申し訳ないですが、結果は全く持って改善されませんでした。
image
image

ComfyUIでの生成時のプロンプト
A detailed illustration of a mecha F-RRS., on a white background.
ワークフロー
loratest.json

学習時のコマンド
accelerate launch --mixed_precision bf16 --num_cpu_threads_per_process 3 sd3_train_network.py --pretrained_model_name_or_path="D:\ComfyUI_windows_portable\ComfyUI\models\checkpoints\sd3.5_large.safetensors" --clip_l="D:\ComfyUI_windows_portable\ComfyUI\models\clip\clip_l.safetensors" --clip_g="D:\ComfyUI_windows_portable\ComfyUI\models\clip\clip_g.safetensors" --t5xxl="D:\ComfyUI_windows_portable\ComfyUI\models\clip\t5xxl_fp16.safetensors" --cache_latents_to_disk --save_model_as safetensors --sdpa --persistent_data_loader_workers --max_data_loader_n_workers 2 --seed 42 --gradient_checkpointing --mixed_precision bf16 --save_precision bf16 --network_module networks.lora_sd3 --network_dim 32 --network_train_unet_only --optimizer_type adamw8bit --learning_rate 1e-4 --cache_text_encoder_outputs --cache_text_encoder_outputs_to_disk --fp8_base --highvram --max_train_epochs 2 --resolution="1024,1024" --save_every_n_epochs 1 --train_data_dir="D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test" --output_dir="D:\Lora_learning\Data\output" --output_name="srdmk3_v05t7_7" --save_every_n_epochs 1 --save_every_n_steps 1000 --sample_every_n_steps 1000 --sample_prompts "D:\Lora_learning\Data\output\prompt.txt" --sample_sampler 'k_euler' --caption_extension=".txt"

学習時のログ

The following values were not passed to `accelerate launch` and had defaults used instead:
        `--num_processes` was set to a value of `1`
        `--num_machines` was set to a value of `1`
        `--dynamo_backend` was set to a value of `'no'`
To avoid this warning pass in values for each of the problematic parameters or run `accelerate config`.
C:\Users\the_X\AppData\Local\Programs\Python\Python311\Lib\site-packages\diffusers\utils\outputs.py:63: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  torch.utils._pytree._register_pytree_node(
C:\Users\the_X\AppData\Local\Programs\Python\Python311\Lib\site-packages\diffusers\utils\outputs.py:63: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  torch.utils._pytree._register_pytree_node(
2024-11-23 18:08:49 INFO     highvram is enabled / highvramが有効です                                                                                                                          train_util.py:4190
                    WARNING  cache_latents_to_disk is enabled, so cache_latents is also enabled / cache_latents_to_diskが有効なため、cache_latentsを有効にします                               train_util.py:4207
2024-11-23 18:08:49 INFO     t5xxl_max_token_length: 256                                                                                                                                 sd3_train_network.py:136
C:\Users\the_X\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\tokenization_utils_base.py:1601: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be depracted in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884
  warnings.warn(
You are using the default legacy behaviour of the <class 'transformers.models.t5.tokenization_t5.T5Tokenizer'>. This is expected, and simply means that the `legacy` (previous) behavior will be used so nothing changes for you. If you want to use the new behaviour, set `legacy=False`. This should only be set if you understand what it means, and thoroughly read the reason why this was added as explained in https://github.com/huggingface/transformers/pull/24565
2024-11-23 18:08:51 INFO     Using DreamBooth method.                                                                                                                                        train_network.py:325
                    INFO     prepare images.                                                                                                                                                   train_util.py:1971
                    INFO     get image size from name of cache files                                                                                                                           train_util.py:1886
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:00<?, ?it/s]
                    INFO     set image size from cache files: 50/50                                                                                                                            train_util.py:1916
                    INFO     found directory D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test\3_A-RRS contains 50 image files                                          train_util.py:1918
read caption: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:00<00:00, 284.13it/s]
                    INFO     get image size from name of cache files                                                                                                                           train_util.py:1886
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:00<?, ?it/s]
                    INFO     set image size from cache files: 50/50                                                                                                                            train_util.py:1916
                    INFO     found directory D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test\3_F-RRS contains 50 image files                                          train_util.py:1918
read caption: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:00<00:00, 295.61it/s]
2024-11-23 18:08:52 INFO     get image size from name of cache files                                                                                                                           train_util.py:1886
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:00<?, ?it/s]
                    INFO     set image size from cache files: 50/50                                                                                                                            train_util.py:1916
                    INFO     found directory D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test\3_MRS contains 50 image files                                            train_util.py:1918
read caption: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:00<00:00, 583.70it/s]
                    INFO     get image size from name of cache files                                                                                                                           train_util.py:1886
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:00<?, ?it/s]
                    INFO     set image size from cache files: 50/50                                                                                                                            train_util.py:1916
                    INFO     found directory D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test\3_SRS contains 50 image files                                            train_util.py:1918
read caption: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:00<00:00, 403.63it/s]
                    INFO     600 train images with repeating.                                                                                                                                  train_util.py:2012
                    INFO     0 reg images.                                                                                                                                                     train_util.py:2015
                    WARNING  no regularization images / 正則化画像が見つかりませんでした                                                                                                       train_util.py:2020
                    INFO     [Dataset 0]                                                                                                                                                       config_util.py:567
                               batch_size: 1
                               resolution: (1024, 1024)
                               enable_bucket: False
                               network_multiplier: 1.0

                               [Subset 0 of Dataset 0]
                                 image_dir: "D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test\3_A-RRS"
                                 image_count: 50
                                 num_repeats: 3
                                 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_epochs: 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
                                 custom_attributes: {}
                                 is_reg: False
                                 class_tokens: A-RRS
                                 caption_extension: .txt

                               [Subset 1 of Dataset 0]
                                 image_dir: "D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test\3_F-RRS"
                                 image_count: 50
                                 num_repeats: 3
                                 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_epochs: 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
                                 custom_attributes: {}
                                 is_reg: False
                                 class_tokens: F-RRS
                                 caption_extension: .txt

                               [Subset 2 of Dataset 0]
                                 image_dir: "D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test\3_MRS"
                                 image_count: 50
                                 num_repeats: 3
                                 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_epochs: 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
                                 custom_attributes: {}
                                 is_reg: False
                                 class_tokens: MRS
                                 caption_extension: .txt

                               [Subset 3 of Dataset 0]
                                 image_dir: "D:\Lora_learning\Data\asset\super_robot_diffusion_XL_V3\multi_Class_test\3_SRS"
                                 image_count: 50
                                 num_repeats: 3
                                 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_epochs: 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
                                 custom_attributes: {}
                                 is_reg: False
                                 class_tokens: SRS
                                 caption_extension: .txt


                    INFO     [Dataset 0]                                                                                                                                                       config_util.py:573
                    INFO     loading image sizes.                                                                                                                                               train_util.py:923
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 200/200 [00:00<?, ?it/s]
                    INFO     prepare dataset                                                                                                                                                    train_util.py:948
                    INFO     preparing accelerator                                                                                                                                           train_network.py:379
accelerator device: cuda
2024-11-23 18:08:53 INFO     Building MMDit                                                                                                                                                       sd3_utils.py:89
                    INFO     Analyzing state dict state...                                                                                                                                        sd3_utils.py:31
                    INFO     Analyzed state dict state: SD3Params(patch_size=2, depth=38, num_patches=36864, pos_embed_max_size=192, adm_in_channels=2048, qk_norm='rms',                         sd3_utils.py:74
                             x_block_self_attn_layers=[], context_embedder_in_features=4096, context_embedder_out_features=2432, model_type='3-5-large')
                    INFO     Loading state dict...                                                                                                                                                sd3_utils.py:94
                    INFO     Loaded MMDiT: <All keys matched successfully>                                                                                                                        sd3_utils.py:96
                    INFO     Cast SD3 model to fp8. This may take a while. You can reduce the time by using fp8 checkpoint. /                                                             sd3_train_network.py:91
                             SD3モデルをfp8に変換しています。これには時間がかかる場合があります。fp8チェックポイントを使用することで時間を短縮できます。
2024-11-23 18:10:10 INFO     Building CLIP-L                                                                                                                                                     sd3_utils.py:122
                    INFO     Loading state dict from D:\ComfyUI_windows_portable\ComfyUI\models\clip\clip_l.safetensors                                                                          sd3_utils.py:148
2024-11-23 18:10:11 INFO     Adding text_projection.weight to clip_l_sd                                                                                                                          sd3_utils.py:152
                    INFO     Loaded CLIP-L: <All keys matched successfully>                                                                                                                      sd3_utils.py:156
                    INFO     Building CLIP-G                                                                                                                                                     sd3_utils.py:182
                    INFO     Loading state dict from D:\ComfyUI_windows_portable\ComfyUI\models\clip\clip_g.safetensors                                                                          sd3_utils.py:208
2024-11-23 18:10:13 INFO     Loaded CLIP-G: <All keys matched successfully>                                                                                                                      sd3_utils.py:211
                    INFO     Loading state dict from D:\ComfyUI_windows_portable\ComfyUI\models\clip\t5xxl_fp16.safetensors                                                                     flux_utils.py:314
                    INFO     Loaded T5xxl: <All keys matched successfully>                                                                                                                      flux_utils.py:317
                    INFO     Building VAE                                                                                                                                                        sd3_utils.py:258
2024-11-23 18:10:14 INFO     Loading state dict...                                                                                                                                               sd3_utils.py:260
2024-11-23 18:10:15 INFO     Loaded VAE: <All keys matched successfully>                                                                                                                         sd3_utils.py:262
import network module: networks.lora_sd3
2024-11-23 18:10:17 INFO     [Dataset 0]                                                                                                                                                       train_util.py:2495
                    INFO     caching latents with caching strategy.                                                                                                                            train_util.py:1048
                    INFO     caching latents...                                                                                                                                                train_util.py:1097
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 200/200 [00:02<00:00, 91.04it/s]
2024-11-23 18:10:19 INFO     move vae and unet to cpu to save memory                                                                                                                     sd3_train_network.py:198
                    INFO     move text encoders to gpu                                                                                                                                   sd3_train_network.py:206
2024-11-23 18:10:25 INFO     [Dataset 0]                                                                                                                                                       train_util.py:2517
                    INFO     caching Text Encoder outputs with caching strategy.                                                                                                               train_util.py:1231
                    INFO     checking cache validity...                                                                                                                                        train_util.py:1242
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 200/200 [00:02<00:00, 97.47it/s]
2024-11-23 18:10:27 INFO     no Text Encoder outputs to cache                                                                                                                                  train_util.py:1269
                    INFO     cache Text Encoder outputs for sample prompt: D:\Lora_learning\Data\output\prompt.txt                                                                       sd3_train_network.py:223
                    INFO     cache Text Encoder outputs for prompt: masterpiece, best quality, (FRS:1.8), full body, mecha, (mecha armor:1.2), (holding weapon:1.5), robot joint, simple sd3_train_network.py:234
                             background
C:\Users\the_X\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\models\clip\modeling_clip.py:480: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:555.)
  attn_output = torch.nn.functional.scaled_dot_product_attention(
2024-11-23 18:10:28 INFO     cache Text Encoder outputs for prompt: low quality, worst quality, bad anatomy,bad composition, poor, low effort                                            sd3_train_network.py:234
2024-11-23 18:10:29 INFO     move CLIP-L back to cpu                                                                                                                                     sd3_train_network.py:249
                    INFO     move CLIP-G back to cpu                                                                                                                                     sd3_train_network.py:251
                    INFO     move t5XXL back to cpu                                                                                                                                      sd3_train_network.py:253
2024-11-23 18:10:31 INFO     move vae and unet back to original device                                                                                                                   sd3_train_network.py:258
                    INFO     create LoRA network. base dim (rank): 32, alpha: 1                                                                                                                   lora_sd3.py:286
                    INFO     neuron dropout: p=None, rank dropout: p=None, module dropout: p=None                                                                                                 lora_sd3.py:287
                    INFO     create LoRA for Text Encoder 1:                                                                                                                                      lora_sd3.py:423
                    INFO     create LoRA for Text Encoder 1: 72 modules.                                                                                                                          lora_sd3.py:426
                    INFO     create LoRA for Text Encoder 2:                                                                                                                                      lora_sd3.py:423
2024-11-23 18:10:32 INFO     create LoRA for Text Encoder 2: 192 modules.                                                                                                                         lora_sd3.py:426
                    INFO     create LoRA for SD3 MMDiT: 377 modules.                                                                                                                              lora_sd3.py:455
                    INFO     enable LoRA for U-Net: 377 modules                                                                                                                                   lora_sd3.py:582
prepare optimizer, data loader etc.
                    INFO     use 8-bit AdamW optimizer | {}                                                                                                                                    train_util.py:4673
override steps. steps for 2 epochs is / 指定エポックまでのステップ数: 1200
enable fp8 training for U-Net.
enable fp8 training for Text Encoder.
                    INFO     set U-Net weight dtype to torch.float8_e4m3fn                                                                                                                   train_network.py:606
running training / 学習開始
  num train images * repeats / 学習画像の数×繰り返し回数: 600
  num reg images / 正則化画像の数: 0
  num batches per epoch / 1epochのバッチ数: 600
  num epochs / epoch数: 2
  batch size per device / バッチサイズ: 1
  gradient accumulation steps / 勾配を合計するステップ数 = 1
  total optimization steps / 学習ステップ数: 1200
steps:   0%|                                                                                                                                                                           | 0/1200 [00:00<?, ?it/s]2024-11-23 18:10:48 INFO     text_encoder is not needed for training. deleting to save memory.                                                                                              train_network.py:1076
                    INFO     unet dtype: torch.float8_e4m3fn, device: cuda:0                                                                                                                train_network.py:1098

epoch 1/2
C:\Users\the_X\AppData\Local\Programs\Python\Python311\Lib\site-packages\diffusers\utils\outputs.py:63: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  torch.utils._pytree._register_pytree_node(
C:\Users\the_X\AppData\Local\Programs\Python\Python311\Lib\site-packages\diffusers\utils\outputs.py:63: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  torch.utils._pytree._register_pytree_node(
C:\Users\the_X\AppData\Local\Programs\Python\Python311\Lib\site-packages\diffusers\utils\outputs.py:63: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  torch.utils._pytree._register_pytree_node(
C:\Users\the_X\AppData\Local\Programs\Python\Python311\Lib\site-packages\diffusers\utils\outputs.py:63: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
  torch.utils._pytree._register_pytree_node(
2024-11-23 18:10:55 INFO     epoch is incremented. current_epoch: 0, epoch: 1                                                                                                                   train_util.py:715
2024-11-23 18:10:55 INFO     epoch is incremented. current_epoch: 0, epoch: 1                                                                                                                   train_util.py:715
C:\Users\the_X\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\checkpoint.py:1399: FutureWarning: `torch.cpu.amp.autocast(args...)` is deprecated. Please use `torch.amp.autocast('cpu', args...)` instead.
  with device_autocast_ctx, torch.cpu.amp.autocast(**cpu_autocast_kwargs), recompute_context:  # type: ignore[attr-defined]

学習時のキャプションの一例
A detailed picture of a mecha named A-RRS. A digital illustration of a futuristic, humanoid mecha with intricate armor plating, red accents, and sharp, angular design. The mecha wields two swords crossed in front, with a detailed, mechanical face and a helmet-like structure. The background is plain white, emphasizing the mecha's detailed, metallic appearance.

本当に何が原因でうまく学習してくれないのかが全くわかりません・・。

@kohya-ss
Copy link
Owner

なかなか悩ましいですね。

DiTのみの学習はnetwork_train_unet_onlyを付けることで行えます。ログによるとINFO enable LoRA for U-Net: 377 modulesとありますので問題ないようです(Text Encoderも学習するとenable LoRA for Text Encoderも合わせて表示されます)。

挙げていただいたキャプションでデフォルトのSD3.5Lで生成するとそれらしい画像が生成されますので、キャプションとしては適切なように思います。

--debug_datasetオプションを付けて起動すると、実際の学習に使用される画像とキャプションが表示されますので、そちらで拡張子指定などが正しいか、念のためご確認いただけますでしょうか。(複数概念ではない場合は正しく学習されるとすると、恐らく問題ないとは思いますが……。)

@waomodder
Copy link
Author

@kohya-ss
kohyaさん、もしよろしければ先ほどの複数概念を分けてトレーニングしたLoraのトレーニングコマンドを教えていただけないでしょうか?
何か自分のコマンドがどこが間違えているのかを比較したいと考えています。

@waomodder
Copy link
Author

--debug_datasetオプションを付けて起動すると、実際の学習に使用される画像とキャプションが表示されますので、そちらで拡張子指定などが正しいか、念のためご確認いただけますでしょうか。

確認は致しました。キャプションも画像もすべて問題ございませんでした。

@kohya-ss
Copy link
Owner

kohyaさん、もしよろしければ先ほどの複数概念を分けてトレーニングしたLoraのトレーニングコマンドを教えていただけないでしょうか?

コマンドは以下になります。

accelerate launch  --mixed_precision bf16 --num_cpu_threads_per_process 1 sd3_train_network.py 
--pretrained_model_name_or_path path\to\sd3\stabilityai-stable-diffusion-3.5-large\sd3.5_large.safetensors 
--clip_l path\to\sd3\clip_l.safetensors --clip_g path\to\sd3\clip_g.safetensors 
--t5xxl path\to\sd3\t5xxl_fp8_e4m3fn.safetensors --cache_latents_to_disk --save_model_as safetensors --sdpa 
--persistent_data_loader_workers --max_data_loader_n_workers 2 --seed 42 --gradient_checkpointing 
--mixed_precision bf16 --save_precision bf16 --network_module networks.lora_sd3 
--network_dim 16 --network_args "loraplus_unet_lr_ratio=4" --network_train_unet_only 
--optimizer_type adamw8bit --learning_rate 1e-3 --cache_text_encoder_outputs --cache_text_encoder_outputs_to_disk 
--fp8_base --highvram --max_train_epochs 8 --save_every_n_epochs 1 
--dataset_config path\to\dataset\ori1_ori2_cap_1024_bs6.toml --output_dir path\to\sd3\lora 
--output_name sd3-ori1ori2-lora --sample_prompts=path\to\prompts_ori12.txt 
--sample_every_n_epochs 1 --sample_at_first

テストのため学習率を高くし、LoRA+を設定していますが、他は特殊な設定はないかと思います。

キャプション、画像とも問題ないとなると、なかなか難しいですね……。

@waomodder
Copy link
Author

共有していただきありがとうございます。
これで一度試してみます!

@waomodder
Copy link
Author

waomodder commented Nov 27, 2024

@kohya-ss
Kohyaさん返信が遅れて申し訳ありません。しばらくいろいろとうまくいきそうで試しましたが、以下の設定が一番近い感じのものになりました。
この設定は以下のサイトの設定を参考にしております。
https://blog.hinablue.me/sd3-5-quickstart-lora-training-with-kohya/

設定(toml形式)

dynamo_backend = "eager" 
dynamo_mode = "default"
mixed_precision = "bf16"
clip_l = "D:/ComfyUI_windows_portable/ComfyUI/models/clip/clip_l.safetensors"
clip_g = "D:/ComfyUI_windows_portable/ComfyUI/models/clip/clip_g.safetensors"
t5xxl = "D:/ComfyUI_windows_portable/ComfyUI/models/clip/t5xxl_fp16.safetensors"
pretrained_model_name_or_path = "D:/ComfyUI_windows_portable/ComfyUI/models/checkpoints/sd3.5_large.safetensors"
train_data_dir = "D:/Lora_learning/Data/asset/super_robot_diffusion_XL_V3/multi_Class_test"
sample_prompts = "D:/Lora_learning/Data/output/prompt.txt"
output_dir = "D:/Lora_learning/Data/output"
output_name = "srdmk3_MC_t11"
unet_lr = 2e-4
text_encoder_lr = [ 5e-5, 5e-5, 5e-5]
train_batch_size = 1
gradient_accumulation_steps = 4
max_train_epochs = 20
save_every_n_epochs = 1
save_every_n_steps = 1000
network_dim = 32
network_alpha = 16
context_attn_dim = 32
context_mlp_dim = 32
x_attn_dim = 32
x_mlp_dim = 32
context_mod_dim = 0
x_mod_dim = 0
apply_t5_attn_mask = true
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_extension = ".txt"
clip_skip = 0
dynamo_backend = "eager"
enable_bucket = true
fp8_base = true
gradient_checkpointing = true
guidance_scale = 1.0
highvram = true
huber_c = 0.1
huber_schedule = "snr"
ip_noise_gamma = 0.1
ip_noise_gamma_random_strength = true
loss_type = "l2"
lr_scheduler = "cosine"
lr_scheduler_args = []
lr_scheduler_num_cycles = 1
lr_scheduler_power = 1
lr_warmup_steps = 200
max_bucket_reso = 2048
max_data_loader_n_workers = 4
max_grad_norm = 0.01
max_timestep = 1000
max_token_length = 225
min_bucket_reso = 256
mixed_precision = "bf16"
network_args = ["train_t5xxl=False", "emb_dims=[0,0,0,0,0,0]", "train_block_indices=12-24,30-37"]
network_module = "networks.lora_sd3"
noise_offset = 0
noise_offset_type = "Original"
optimizer_args = ["weight_decay=0.01", "betas=0.9,0.999", "eps=0.000001",]
optimizer_type = "AdamW8bit"
persistent_data_loader_workers = 1
prior_loss_weight = 1
resolution = "1024,1024"
sample_sampler = "euler_a"
save_model_as = "safetensors"
save_precision = "fp16"
save_state_on_train_end = true
sdpa = true
seed = 42
network_train_unet_only = true

出力結果(データセットは前のものと同様)

・SRS
ComfyUI_01503_

・MRS
ComfyUI_01504_

・FRS
ComfyUI_01505_

・A-RRS
image

一応分けては覚えてはくれますが、まだまだそっくりとは言えないレベルです。
SDXLであればnetwork_dimが32程度あれば分けて覚えてくれるはずですが、まだ何かが足りないようです。
weighting_schemeをuniformにしたりtraining shiftを1に設定したりとまだまだやれるところはありそうです。

@kohya-ss
Copy link
Owner

共有いただき、ありがとうございます。いくらか改善されたようですね。network_train_unet_only = trueでDiTのみの学習のようですし、大きな違いはtrain_block_indicesの指定でしょうか。自然文はあまり関係ないようで失礼いたしました。

weighting_schemeはuniformが、training_shiftは1がデフォルトかと思いますので、他の値にすることでまた変わってくる可能性はありそうです。

なかなか試す時間が取れませんが、もし何か情報など得ましたら私からも共有させていただきます。

@waomodder
Copy link
Author

色々と時間を割いていただいて申し訳ありません・・。
まだまだSD3.5は情報が少ないので、少しでも良きトレーニングができた際には情報共有させていただきます。

@waomodder
Copy link
Author

@kohya-ss
Kohyaさん・・。遂に、分けて覚えてもらえる方法が分かりました・・。
LycorisのLohaを使えばLoraよりもかなりいい感じに覚えてくれました!
4つの概念の中でも2つはかなり正確に分けて覚えてくれてます。
学習ステップは約6000は回しております。

SRS
image

MRS
image

FRS
image

A-RRS
image

学習に使用した設定ファイル

[Basics]
clip_l = "D:/ComfyUI_windows_portable/ComfyUI/models/clip/clip_l.safetensors"
clip_g = "D:/ComfyUI_windows_portable/ComfyUI/models/clip/clip_g.safetensors"
t5xxl = "D:/ComfyUI_windows_portable/ComfyUI/models/clip/t5xxl_fp16.safetensors"
pretrained_model_name_or_path = "D:/ComfyUI_windows_portable/ComfyUI/models/checkpoints/sd3.5_large.safetensors"
train_data_dir = "D:/Lora_learning/Data/asset/super_robot_diffusion_XL_V3/multi_Class_test"
resolution="1024,1024"
seed = 23
#max_train_steps = 10000	# This is overwritten by max_train_epochs anyway
max_train_epochs = 15
clip_skip = 0

[Save]
output_dir = "D:/Lora_learning/Data/output"
output_name = "srdmk3_MC_t7_2"
save_precision = "fp16"
save_model_as = "safetensors"
save_every_n_epochs = 1
save_every_n_steps = 1000
save_state = false
save_last_n_steps_state = 1	# basically saving the last + final state if save_state set to true
# save_last_n_epochs_state = 1
# save_n_epoch_ratio = 10
# save_last_n_epochs = 10
# save_last_n_steps = 100000

[SDv2]
v2 = false
v_parameterization = false
scale_v_pred_loss_like_noise_pred = false

[Network_setup]
network_dim = 8
network_alpha = 4
dim_from_weights = false
network_dropout = 0
network_train_unet_only = false
network_train_text_encoder_only = false
resume = false
# network_weights = 'path/to/network_weights'
# base_weights = 'path/to/base_weights'
# base_weights_multiplier = 1

[LyCORIS]
network_module = "lycoris.kohya"
network_args = [ "preset=full", "algo=loha", "conv_dim=4", "conv_alpha=2"]

[Optimizer]
train_batch_size = 1
gradient_checkpointing = true
gradient_accumulation_steps = 1
optimizer_type = "AdamW"
unet_lr = 2e-4
text_encoder_lr = [ 2e-4, 2e-4, 5e-5]
max_grad_norm = 0.01
optimizer_args = [ "weight_decay=0.1", "betas=0.9,0.99",]


[Lr_scheduler]
lr_scheduler_type = ""
lr_scheduler = "constant"
lr_warmup_steps = 0
lr_scheduler_num_cycles = 1
lr_scheduler_power = 1.0	# Polynomial power for polynomial scheduler
# lr_scheduler_args = ...

[Training_preciscion]
mixed_precision = "bf16"
full_fp16 = false

[Further_improvement]
min_snr_gamma = 5
# noise_offset = 0.05   # cannot be set with multires_noise
# adaptive_noise_scale = 0
multires_noise_discount = 0.3
multires_noise_iterations = 10
# scale_weight_norms = 1

[ARB]
enable_bucket = true
min_bucket_reso = 64
max_bucket_reso = 2048
bucket_reso_steps = 64
bucket_no_upscale = false

[Captions]
shuffle_caption = false
caption_extension = ".txt"
keep_tokens = 0
caption_dropout_rate = 0.05
caption_dropout_every_n_epochs = 0
caption_tag_dropout_rate = 0.0
max_token_length = 150
weighted_captions = false
token_warmup_min = 1
token_warmup_step = 0

[Attention]
mem_eff_attn = false
xformers = false
sdpa = true

[Data_augmentation]
color_aug = false
flip_aug = false
random_crop = false

[Cache_latents]
cache_latents = true
vae_batch_size = 1
cache_latents_to_disk = true

[Sampling_during_training]
#sample_sampler = "ddim"
# sample_every_n_steps = 1000	# overwritten by n_epochs
# sample_every_n_epochs = 1
# sample_prompts = "sample_prompts.txt"

[Logging]
#logging_dir = "logs_training"
#log_with = "tensorboard"
#log_prefix = "lohr_"
# log_tracker_name = ?
# wandb_api_key = ?

[Dataset]
max_data_loader_n_workers = 8
persistent_data_loader_workers = true
#dataset_repeats = 1	# Not sure how this is used 
# dataset_class = package.module.Class
# dataset_config = ...

[Regularization]
# This is not really needed because you can do regularization by putting everything in train
# reg_data_dir = "/path/to/reg"
prior_loss_weight = 1.0

[Huggingface]
save_state_to_huggingface = false
resume_from_huggingface = false
async_upload = false
# There are more arguments

[Debugging]
debug_dataset = false

[Deprecated]
use_8bit_adam = false
use_lion_optimizer = false
learning_rate = 0.0002

[Others]
loss_type = "l2"
huber_c = 0.1
huber_schedule = "snr"
lowram = false
fp8_base = false
gradient_checkpointing = true
guidance_scale = 1.0
highvram = true
blocks_to_swap = 36
weighting_scheme = "uniform"
training_shift = 1
network_train_unet_only = false
# in_json = "/path/to/json_metadata"
# face_crop_aug_range = 2.0
# vae = "/path/to/vae"
training_comment = ""

今までの中でも一番いい出来なので、SD3.5はLoraよりもLohaやLokrを使用するほうがいいのかもしれませんね。

@waomodder
Copy link
Author

追記
言い忘れてましたが、このLycorisは最新版で独自にインストールしたものを使用してます。
最新バージョンでSD3.5に対応したそうで、普通に動作しました。
ただ、SD3.5でnetwork_argsに"train_norm=True"を使用した際はエラーで動作が止まってしまいました。
それ以外は特に問題なく動作しているそうです。

@kohya-ss
Copy link
Owner

kohya-ss commented Dec 1, 2024

報告ありがとうございます。LoHaやLoKrが向いている、というのは新しい発見ですね。それぞれ近似の方法が異なるようですので、SD3.5に向いている、またはDiTに向いている、などがあるのかもしれません。

LyCORISはSD3.5に対応していただいたのはありがたい限りです。

@waomodder
Copy link
Author

>LoHaやLoKrが向いている、というのは新しい発見ですね。
X上で青龍聖者さんをはじめとした方々が、DiTモデルではLoraよりLoha、Lokrのほうがコンセプトの漏れが少ないというツイートを見かけてもしやと思ってやってみたら、かなりいい結果を出してくれました。
情報がなければそういった発想も無かったので、学習に関する情報を共有していただけるのはありがたいです。

あの後にも学習を軽く行いましたが、ある事に気が付きました。
max_grad_normを0.01から0.03にして学習したら、ぐちゃぐちゃな結果になって似ても似つかないものが生成されました。
もしかしたらscale_weight_normsなどでネットワークの重みの制限を掛ければ安定して学習するのかもしれません。

@waomodder
Copy link
Author

Kohyaさん、今回あることが分かりましたので報告いたします。
SD3.5は複数概念を覚えてもらう際に3つまでの概念は覚えてもらえますが、何故か4つ以上の概念を覚える際には情報が上書きされて忘れてしまっているのではないかと思います。
データセットの内容は同じものですが、前はSRS(胸にライオンのあるロボット)とMRS(緑のロボット)は覚えてもらいました。
しかし、今回は逆にA-RRS(足の太いロボット)とFRS(白い騎士のようなロボット)とMRSを覚え、SRSを指定しても全く覚えてもらいませんでした。
以下は生成された画像です。
DiT、TEともに1の強度で生成してます。

・A-RRS
image

・FRS
image

・MRS(これだけTEを1.5の強度で生成)
image

・SRS
image

うーん・・。TEに問題があるのかTEの学習を強化すべきなのか・・。
あと少しでちゃんと分けて学習してもらえるはずだと思うんですけどねぇ・・。

@waomodder
Copy link
Author

追記

その時の学習パラメーターはこちらとなります。

[Basics]
clip_l = "D:/ComfyUI_windows_portable/ComfyUI/models/clip/clip_l.safetensors"
clip_g = "D:/ComfyUI_windows_portable/ComfyUI/models/clip/clip_g.safetensors"
t5xxl = "D:/ComfyUI_windows_portable/ComfyUI/models/clip/t5xxl_fp16.safetensors"
pretrained_model_name_or_path = "D:/ComfyUI_windows_portable/ComfyUI/models/checkpoints/sd3.5_large.safetensors"
train_data_dir = "D:/Lora_learning/Data/asset/super_robot_diffusion_XL_V3/multi_Class_test"
resolution="1024,1024"
seed = 23
#max_train_steps = 10000	# This is overwritten by max_train_epochs anyway
max_train_epochs = 10
clip_skip = 0

[Save]
output_dir = "D:/Lora_learning/Data/output"
output_name = "srdmk3_MC_t7_7"
save_precision = "fp16"
save_model_as = "safetensors"
save_every_n_epochs = 1
save_every_n_steps = 100
save_state = false
save_last_n_steps_state = 1	# basically saving the last + final state if save_state set to true
# save_last_n_epochs_state = 1
# save_n_epoch_ratio = 10
# save_last_n_epochs = 10
# save_last_n_steps = 100000

[SDv2]
v2 = false
v_parameterization = false
scale_v_pred_loss_like_noise_pred = false

[Network_setup]
network_dim = 8
network_alpha = 8
dim_from_weights = false
network_dropout = 0
network_train_unet_only = false
network_train_text_encoder_only = false
resume = false
# network_weights = 'path/to/network_weights'
# base_weights = 'path/to/base_weights'
# base_weights_multiplier = 1

[LyCORIS]
network_module = "lycoris.kohya"
network_args = [ "preset=full", "algo=loha", "conv_dim=8", "conv_alpha=8"]

[Optimizer]
train_batch_size = 1
gradient_checkpointing = true
gradient_accumulation_steps = 1
optimizer_type = "AdamW"
unet_lr = 3e-4
text_encoder_lr = [ 2e-4, 2e-4, 5e-5]
max_grad_norm = 0.01
optimizer_args = [ "weight_decay=0.1", "betas=0.9,0.99"]


[Lr_scheduler]
lr_scheduler_type = ""
lr_scheduler = "constant"
lr_warmup_steps = 0
lr_scheduler_num_cycles = 1
lr_scheduler_power = 1.0	# Polynomial power for polynomial scheduler
# lr_scheduler_args = ...

[Training_preciscion]
mixed_precision = "bf16"
full_fp16 = false

[Further_improvement]
min_snr_gamma = 3
# noise_offset = 0.05   # cannot be set with multires_noise
# adaptive_noise_scale = 0
multires_noise_discount = 0.3
multires_noise_iterations = 10
#scale_weight_norms = 2.0

[ARB]
enable_bucket = true
min_bucket_reso = 64
max_bucket_reso = 2048
bucket_reso_steps = 64
bucket_no_upscale = true

[Captions]
shuffle_caption = false
caption_extension = ".txt"
keep_tokens = 0
caption_dropout_rate = 0.0
caption_dropout_every_n_epochs = 0
caption_tag_dropout_rate = 0.0
#max_token_length = 150
weighted_captions = false
token_warmup_min = 1
token_warmup_step = 0

[Attention]
mem_eff_attn = false
xformers = false
sdpa = true

[Data_augmentation]
color_aug = false
flip_aug = false
random_crop = false

[Cache_latents]
cache_latents = true
vae_batch_size = 1
cache_latents_to_disk = true

[Sampling_during_training]
# sample_sampler = "ddim"
# sample_every_n_steps = 1000	# overwritten by n_epochs
# sample_every_n_epochs = 1
# sample_prompts = "sample_prompts.txt"

[Logging]
#logging_dir = "logs_training"
#log_with = "tensorboard"
#log_prefix = "lohr_"
# log_tracker_name = ?
# wandb_api_key = ?

[Dataset]
max_data_loader_n_workers = 8
persistent_data_loader_workers = true
#dataset_repeats = 1	# Not sure how this is used 
# dataset_class = package.module.Class
# dataset_config = ...

[Regularization]
# This is not really needed because you can do regularization by putting everything in train
# reg_data_dir = "/path/to/reg"
prior_loss_weight = 1.0

[Huggingface]
save_state_to_huggingface = false
resume_from_huggingface = false
async_upload = false
# There are more arguments

[Debugging]
debug_dataset = false

[Deprecated]
use_8bit_adam = false
use_lion_optimizer = false
#learning_rate = 0.0002

[Others]
loss_type = "l2"
huber_c = 0.1
huber_schedule = "snr"
lowram = false
fp8_base = false
gradient_checkpointing = true
guidance_scale = 1.0
highvram = true
blocks_to_swap = 36
weighting_scheme = "uniform"
training_shift = 1
network_train_unet_only = false
# in_json = "/path/to/json_metadata"
# face_crop_aug_range = 2.0
# vae = "/path/to/vae"
training_comment = ""

@kohya-ss
Copy link
Owner

kohya-ss commented Dec 2, 2024

共有ありがとうございます。3個でも4個でも、モデルへの学習としては大きな違いはないと思うのですが、謎ですね。トークンが分割された結果、似たようなトークンになっているのかと思いましたが、FRS、MRS、SRSは、少なくともCLIPではそれぞれ1トークンになるようでした……。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants