mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-18 01:30:02 +00:00
Change system prompt to inject Prompt Start special token
This commit is contained in:
@@ -1692,7 +1692,8 @@ class BaseDataset(torch.utils.data.Dataset):
|
||||
text_encoder_outputs_list.append(text_encoder_outputs)
|
||||
|
||||
if tokenization_required:
|
||||
system_prompt = subset.system_prompt or ""
|
||||
system_prompt_special_token = "<Prompt Start>"
|
||||
system_prompt = f"{subset.system_prompt} {system_prompt_special_token} " if subset.system_prompt else ""
|
||||
caption = self.process_caption(subset, image_info.caption)
|
||||
input_ids = [ids[0] for ids in self.tokenize_strategy.tokenize(system_prompt + caption)] # remove batch dimension
|
||||
# if self.XTI_layers:
|
||||
@@ -2091,7 +2092,8 @@ class DreamBoothDataset(BaseDataset):
|
||||
else:
|
||||
num_train_images += num_repeats * len(img_paths)
|
||||
|
||||
system_prompt = self.system_prompt or subset.system_prompt or ""
|
||||
system_prompt_special_token = "<Prompt Start>"
|
||||
system_prompt = f"{self.system_prompt or subset.system_prompt} {system_prompt_special_token} " if self.system_prompt or subset.system_prompt else ""
|
||||
for img_path, caption, size in zip(img_paths, captions, sizes):
|
||||
info = ImageInfo(img_path, num_repeats, system_prompt + caption, subset.is_reg, img_path)
|
||||
if size is not None:
|
||||
|
||||
Reference in New Issue
Block a user