Commit 9a1aff64 authored by parasi's avatar parasi
Browse files

resolve [name] after resolving [filewords] in training

parent 98947d17
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -97,13 +97,13 @@ 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.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))
        text = text.replace("[name]", self.placeholder_token)
        return text

    def __len__(self):