Skip to content

Commit 39827a3

Browse files
Merge pull request #4688 from parasi22/resolve-embedding-name-in-filewords
resolve [name] after resolving [filewords] in training
2 parents 9e78d2c + 9a1aff6 commit 39827a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/textual_inversion/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ def __init__(self, data_root, width, height, repeats, flip_p=0.5, placeholder_to
117117

118118
def create_text(self, filename_text):
119119
text = random.choice(self.lines)
120-
text = text.replace("[name]", self.placeholder_token)
121120
tags = filename_text.split(',')
122121
if self.tag_drop_out != 0:
123122
tags = [t for t in tags if random.random() > self.tag_drop_out]
124123
if self.shuffle_tags:
125124
random.shuffle(tags)
126125
text = text.replace("[filewords]", ','.join(tags))
126+
text = text.replace("[name]", self.placeholder_token)
127127
return text
128128

129129
def __len__(self):

0 commit comments

Comments
 (0)