Merge pull request #4688 from parasi22/resolve-embedding-name-in-filewords

resolve [name] after resolving [filewords] in training
This commit is contained in:
AUTOMATIC1111 2022-11-27 22:46:49 +03:00 committed by GitHub
commit 39827a3998
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,13 +117,13 @@ class PersonalizedBase(Dataset):
def create_text(self, filename_text): def create_text(self, filename_text):
text = random.choice(self.lines) text = random.choice(self.lines)
text = text.replace("[name]", self.placeholder_token)
tags = filename_text.split(',') tags = filename_text.split(',')
if self.tag_drop_out != 0: if self.tag_drop_out != 0:
tags = [t for t in tags if random.random() > self.tag_drop_out] tags = [t for t in tags if random.random() > self.tag_drop_out]
if self.shuffle_tags: if self.shuffle_tags:
random.shuffle(tags) random.shuffle(tags)
text = text.replace("[filewords]", ','.join(tags)) text = text.replace("[filewords]", ','.join(tags))
text = text.replace("[name]", self.placeholder_token)
return text return text
def __len__(self): def __len__(self):