From 1abbfd5215a99dba9d699e91baec00e6f02a0bd5 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 17 Jan 2023 08:13:39 +0100 Subject: Update --- models/clip/embeddings.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'models/clip') diff --git a/models/clip/embeddings.py b/models/clip/embeddings.py index 9a23a2a..1cc59d9 100644 --- a/models/clip/embeddings.py +++ b/models/clip/embeddings.py @@ -100,6 +100,9 @@ class ManagedCLIPTextEmbeddings(CLIPTextEmbeddings): return embeds def normalize(self, target: float = 0.4, lambda_: float = 1.0): + if lambda_ == 0: + return + w = self.temp_token_embedding.weight pre_norm = w[self.temp_token_ids, :].norm(dim=-1, keepdim=True) w[self.temp_token_ids] = F.normalize( -- cgit v1.2.3-70-g09d2