mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-09 06:45:09 +00:00
Merge pull request #157 from shirayu/improve_tag_shuffle
Always join with ", "
This commit is contained in:
@@ -265,7 +265,7 @@ class BaseDataset(torch.utils.data.Dataset):
|
|||||||
|
|
||||||
def process_caption(self, caption):
|
def process_caption(self, caption):
|
||||||
if self.shuffle_caption:
|
if self.shuffle_caption:
|
||||||
tokens = caption.strip().split(",")
|
tokens = [t.strip() for t in caption.strip().split(",")]
|
||||||
if self.shuffle_keep_tokens is None:
|
if self.shuffle_keep_tokens is None:
|
||||||
random.shuffle(tokens)
|
random.shuffle(tokens)
|
||||||
else:
|
else:
|
||||||
@@ -274,7 +274,7 @@ class BaseDataset(torch.utils.data.Dataset):
|
|||||||
tokens = tokens[self.shuffle_keep_tokens:]
|
tokens = tokens[self.shuffle_keep_tokens:]
|
||||||
random.shuffle(tokens)
|
random.shuffle(tokens)
|
||||||
tokens = keep_tokens + tokens
|
tokens = keep_tokens + tokens
|
||||||
caption = ",".join(tokens).strip()
|
caption = ", ".join(tokens)
|
||||||
|
|
||||||
for str_from, str_to in self.replacements.items():
|
for str_from, str_to in self.replacements.items():
|
||||||
if str_from == "":
|
if str_from == "":
|
||||||
|
|||||||
Reference in New Issue
Block a user