From eb0838bd2bf96d34dd779f847552291379fe543f Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 1 Jan 2023 20:48:04 +0100 Subject: Cleanup --- models/clip/embeddings.py | 11 ----------- models/clip/tokenizer.py | 1 + 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'models/clip') diff --git a/models/clip/embeddings.py b/models/clip/embeddings.py index 8602142..f90e7c2 100644 --- a/models/clip/embeddings.py +++ b/models/clip/embeddings.py @@ -120,14 +120,3 @@ def patch_managed_embeddings(text_encoder: CLIPTextModel) -> ManagedCLIPTextEmbe text_embeddings = ManagedCLIPTextEmbeddings(text_encoder.config, text_encoder.text_model.embeddings) text_encoder.text_model.embeddings = text_embeddings return text_embeddings - - -def unpatch_managed_embeddings(text_encoder: CLIPTextModel) -> CLIPTextEmbeddings: - text_encoder.text_model.embeddings.make_permanent() - - text_embeddings = CLIPTextEmbeddings(text_encoder.config) - text_embeddings.token_embedding = text_encoder.text_model.embeddings.token_embedding - text_embeddings.position_embedding = text_encoder.text_model.embeddings.position_embedding - text_encoder.text_model.embeddings = text_embeddings - - return text_embeddings diff --git a/models/clip/tokenizer.py b/models/clip/tokenizer.py index 5e33f3e..bd0bd21 100644 --- a/models/clip/tokenizer.py +++ b/models/clip/tokenizer.py @@ -57,6 +57,7 @@ class MultiCLIPTokenizerItem(NamedTuple): class MultiCLIPTokenizer(CLIPTokenizer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self.token_map: dict[int, list[int]] = {} self.vector_shuffle = shuffle_none -- cgit v1.2.3-70-g09d2