diff options
author | KyuSeok Jung <wjdrbtjr495@gmail.com> | 2022-11-11 01:29:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 01:29:55 +0000 |
commit | 13a2f1dca32980339e1fb4d1995cde428db798c5 (patch) | |
tree | 5621793cccf1841fca4a81e69505197c8a26a915 /modules/textual_inversion/dataset.py | |
parent | 6f8a807fe4eb41f6eb355c80fe96cd60b8e8a5a9 (diff) | |
download | stable-diffusion-webui-gfx803-13a2f1dca32980339e1fb4d1995cde428db798c5.tar.gz stable-diffusion-webui-gfx803-13a2f1dca32980339e1fb4d1995cde428db798c5.tar.bz2 stable-diffusion-webui-gfx803-13a2f1dca32980339e1fb4d1995cde428db798c5.zip |
adding tag drop out option
Diffstat (limited to 'modules/textual_inversion/dataset.py')
-rw-r--r-- | modules/textual_inversion/dataset.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/textual_inversion/dataset.py b/modules/textual_inversion/dataset.py index df278dc2..a95c7835 100644 --- a/modules/textual_inversion/dataset.py +++ b/modules/textual_inversion/dataset.py @@ -98,12 +98,12 @@ class PersonalizedBase(Dataset): def create_text(self, filename_text):
text = random.choice(self.lines)
text = text.replace("[name]", self.placeholder_token)
+ tags = filename_text.split(',')
+ if shared.opt.tag_drop_out != 0:
+ tags = [t for t in tags if random.random() > shared.opt.tag_drop_out]
if shared.opts.shuffle_tags:
- tags = filename_text.split(',')
random.shuffle(tags)
- text = text.replace("[filewords]", ','.join(tags))
- else:
- text = text.replace("[filewords]", filename_text)
+ text = text.replace("[filewords]", ','.join(tags))
return text
def __len__(self):
|