From 5ff238bd5bb422d855d5f0b8c81402e74a9da3cc Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 7 Jan 2023 08:55:31 +0100 Subject: Update --- models/clip/embeddings.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'models') diff --git a/models/clip/embeddings.py b/models/clip/embeddings.py index 384c795..9d8f770 100644 --- a/models/clip/embeddings.py +++ b/models/clip/embeddings.py @@ -53,8 +53,6 @@ class ManagedCLIPTextEmbeddings(CLIPTextEmbeddings): self.token_embedding = resize_embedding(self.token_embedding, size, self.initializer_factor) def add_embed(self, token_ids: Union[int, list[int]], initializer: Optional[Union[int, list[int], torch.FloatTensor]] = None): - init_ratio = 1.0 - if isinstance(token_ids, int): token_ids = [token_ids] @@ -65,7 +63,6 @@ class ManagedCLIPTextEmbeddings(CLIPTextEmbeddings): initializer = [initializer] if isinstance(initializer, list): - init_ratio = len(initializer) / len(token_ids) initializer = (initializer * len(token_ids))[:len(token_ids)] with torch.no_grad(): @@ -79,8 +76,6 @@ class ManagedCLIPTextEmbeddings(CLIPTextEmbeddings): dtype=self.temp_token_embedding.weight.dtype, ) - return init_ratio - def load_embed(self, input_ids: list[int], filename: Path): with safe_open(filename, framework="pt", device="cpu") as file: self.add_embed(input_ids, file.get_tensor("embed")) -- cgit v1.2.3-70-g09d2