aboutsummaryrefslogtreecommitdiff
path: root/modules/textual_inversion
diff options
context:
space:
mode:
authorNoCrypt <57245077+NoCrypt@users.noreply.github.com>2022-11-11 21:14:10 +0700
committerGitHub <noreply@github.com>2022-11-11 21:14:10 +0700
commit6165f07e74f05543bf9039dda5d66686d18d985a (patch)
tree8b5d06daf8ed9626e2ac7f872720b87e1207bced /modules/textual_inversion
parentc556d34523e8764bd66bf6a7bf97d06add420020 (diff)
parente666220ee458ae1e80a2ba12c64a0da9d68f20a2 (diff)
Merge branch 'master' into patch-1
Diffstat (limited to 'modules/textual_inversion')
-rw-r--r--modules/textual_inversion/dataset.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/textual_inversion/dataset.py b/modules/textual_inversion/dataset.py
index ad726577..eb75c376 100644
--- a/modules/textual_inversion/dataset.py
+++ b/modules/textual_inversion/dataset.py
@@ -98,7 +98,12 @@ class PersonalizedBase(Dataset):
def create_text(self, filename_text):
text = random.choice(self.lines)
text = text.replace("[name]", self.placeholder_token)
- text = text.replace("[filewords]", filename_text)
+ tags = filename_text.split(',')
+ if shared.opts.tag_drop_out != 0:
+ tags = [t for t in tags if random.random() > shared.opts.tag_drop_out]
+ if shared.opts.shuffle_tags:
+ random.shuffle(tags)
+ text = text.replace("[filewords]", ','.join(tags))
return text
def __len__(self):