adding tag drop out option
This commit is contained in:
parent
6f8a807fe4
commit
13a2f1dca3
1 changed files with 4 additions and 4 deletions
|
@ -98,12 +98,12 @@ 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)
|
text = text.replace("[name]", self.placeholder_token)
|
||||||
if shared.opts.shuffle_tags:
|
|
||||||
tags = filename_text.split(',')
|
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:
|
||||||
random.shuffle(tags)
|
random.shuffle(tags)
|
||||||
text = text.replace("[filewords]", ','.join(tags))
|
text = text.replace("[filewords]", ','.join(tags))
|
||||||
else:
|
|
||||||
text = text.replace("[filewords]", filename_text)
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
|
|
Loading…
Reference in a new issue