From 9f52607be1247d1bd6801944f4a97d53499af515 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sat, 24 Aug 2024 18:48:04 +0300 Subject: [PATCH] class_token first instead --- library/train_util.py | 2 +- nodes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/train_util.py b/library/train_util.py index b9fa934..2882c8a 100644 --- a/library/train_util.py +++ b/library/train_util.py @@ -1775,7 +1775,7 @@ class DreamBoothDataset(BaseDataset): else: final_caption = cap_for_img if subset.class_tokens: - final_caption += f" {subset.class_tokens}" # Concatenate class token to the caption + final_caption = f"{subset.class_tokens} {final_caption}" # Prepend class token to the caption captions.append(final_caption) diff --git a/nodes.py b/nodes.py index 25ce008..500bcf6 100644 --- a/nodes.py +++ b/nodes.py @@ -105,7 +105,7 @@ class TrainDatasetAdd: "height": ("INT",{"min": 64, "default": 1024, "tooltip": "image height when bucketing is not used, also the default validation sampling height"}), "batch_size": ("INT",{"min": 1, "default": 2, "tooltip": "Higher batch size uses more memory and generalizes the training more. "}), "dataset_path": ("STRING",{"multiline": True, "default": "", "tooltip": "path to dataset, root is ComfyUI folder"}), - "class_tokens": ("STRING",{"multiline": True, "default": "", "tooltip": "aka trigger word, if specified, will be added to the end of each caption, if no captions exist, will be used on it's own"}), + "class_tokens": ("STRING",{"multiline": True, "default": "", "tooltip": "aka trigger word, if specified, will be added to the start of each caption, if no captions exist, will be used on it's own"}), "enable_bucket": ("BOOLEAN",{"default": True, "tooltip": "enable buckets for multi aspect ratio training"}), "bucket_no_upscale": ("BOOLEAN",{"default": False, "tooltip": "bucket reso is defined by image size automatically"}), "num_repeats": ("INT", {"default": 1, "min": 1, "tooltip": "number of times to repeat dataset for an epoch"}),