Upload graph-embeddings-frommodel.py
Browse files
graph-embeddings-frommodel.py
CHANGED
@@ -67,6 +67,13 @@ def load_overlay():
|
|
67 |
print("Attempting to update old from new")
|
68 |
sd=model.state_dict()
|
69 |
sd.update(overlay)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
print("Reloading merged data")
|
71 |
model.load_state_dict(sd)
|
72 |
model = model.to(device)
|
|
|
67 |
print("Attempting to update old from new")
|
68 |
sd=model.state_dict()
|
69 |
sd.update(overlay)
|
70 |
+
|
71 |
+
# surprisingly, CLIPModel doesnt use, or want, this key!?!
|
72 |
+
# have to remove it.
|
73 |
+
if "text_model.embeddings.position_ids" in sd:
|
74 |
+
print("Removing key text_model.embeddings.position_ids")
|
75 |
+
sd.pop("text_model.embeddings.position_ids")
|
76 |
+
|
77 |
print("Reloading merged data")
|
78 |
model.load_state_dict(sd)
|
79 |
model = model.to(device)
|