From c2ad274d5eb929626a6b6b02dae19b6ea6a4d534 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 1 Jan 2023 00:25:14 +0100 Subject: Better token shuffling --- models/clip/tokenizer.py | 5 +++-- 1 file 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): tokens = self.token_map[id] if vector_shuffle: - tokens = copy.copy(tokens) - np.random.shuffle(tokens) + subtokens = tokens[1:-1] + np.random.shuffle(subtokens) + tokens = tokens[:1] + subtokens + tokens[-1:] return tokens else: -- cgit v1.2.3-70-g09d2