summaryrefslogtreecommitdiffstats
path: root/models/clip/embeddings.py
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2023-01-01 20:48:04 +0100
committerVolpeon <git@volpeon.ink>2023-01-01 20:48:04 +0100
commiteb0838bd2bf96d34dd779f847552291379fe543f (patch)
tree501c41a8330a06ee0b0939a47ae74c281129ab47 /models/clip/embeddings.py
parentFix MultiCLIPTokenizer (forgot to override encode) (diff)
downloadtextual-inversion-diff-eb0838bd2bf96d34dd779f847552291379fe543f.tar.gz
textual-inversion-diff-eb0838bd2bf96d34dd779f847552291379fe543f.tar.bz2
textual-inversion-diff-eb0838bd2bf96d34dd779f847552291379fe543f.zip
Cleanup
Diffstat (limited to 'models/clip/embeddings.py')
-rw-r--r--models/clip/embeddings.py11
1 files changed, 0 insertions, 11 deletions
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
120 text_embeddings = ManagedCLIPTextEmbeddings(text_encoder.config, text_encoder.text_model.embeddings) 120 text_embeddings = ManagedCLIPTextEmbeddings(text_encoder.config, text_encoder.text_model.embeddings)
121 text_encoder.text_model.embeddings = text_embeddings 121 text_encoder.text_model.embeddings = text_embeddings
122 return text_embeddings 122 return text_embeddings
123
124
125def unpatch_managed_embeddings(text_encoder: CLIPTextModel) -> CLIPTextEmbeddings:
126 text_encoder.text_model.embeddings.make_permanent()
127
128 text_embeddings = CLIPTextEmbeddings(text_encoder.config)
129 text_embeddings.token_embedding = text_encoder.text_model.embeddings.token_embedding
130 text_embeddings.position_embedding = text_encoder.text_model.embeddings.position_embedding
131 text_encoder.text_model.embeddings = text_embeddings
132
133 return text_embeddings