summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2023-01-01 00:25:14 +0100
committerVolpeon <git@volpeon.ink>2023-01-01 00:25:14 +0100
commitc2ad274d5eb929626a6b6b02dae19b6ea6a4d534 (patch)
tree8308072c933309a42a717acb2da5bddabb205abc /models
parentFix (diff)
downloadtextual-inversion-diff-c2ad274d5eb929626a6b6b02dae19b6ea6a4d534.tar.gz
textual-inversion-diff-c2ad274d5eb929626a6b6b02dae19b6ea6a4d534.tar.bz2
textual-inversion-diff-c2ad274d5eb929626a6b6b02dae19b6ea6a4d534.zip
Better token shuffling
Diffstat (limited to 'models')
-rw-r--r--models/clip/tokenizer.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/models/clip/tokenizer.py b/models/clip/tokenizer.py
index fbfe790..256d442 100644
--- a/models/clip/tokenizer.py
+++ b/models/clip/tokenizer.py
@@ -47,8 +47,9 @@ class MultiCLIPTokenizer(CLIPTokenizer):
47 tokens = self.token_map[id] 47 tokens = self.token_map[id]
48 48
49 if vector_shuffle: 49 if vector_shuffle:
50 tokens = copy.copy(tokens) 50 subtokens = tokens[1:-1]
51 np.random.shuffle(tokens) 51 np.random.shuffle(subtokens)
52 tokens = tokens[:1] + subtokens + tokens[-1:]
52 53
53 return tokens 54 return tokens
54 else: 55 else: