From b31fcb741432076f7e2f3ec9423ad935a08c6671 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 16 May 2023 07:12:14 +0200 Subject: Support LoRA training for token embeddings --- models/clip/embeddings.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'models') diff --git a/models/clip/embeddings.py b/models/clip/embeddings.py index 2b23bd3..7c7f2ac 100644 --- a/models/clip/embeddings.py +++ b/models/clip/embeddings.py @@ -86,6 +86,9 @@ def patch_managed_embeddings( alpha: int = 8, dropout: float = 0.0 ) -> ManagedCLIPTextEmbeddings: + if isinstance(text_encoder.text_model.embeddings, ManagedCLIPTextEmbeddings): + return text_encoder.text_model.embeddings + text_embeddings = ManagedCLIPTextEmbeddings( text_encoder.config, text_encoder.text_model.embeddings, -- cgit v1.2.3-70-g09d2