Upload ZeroShotEmbedding
Browse files- config.json +1 -1
- model.py +8 -0
- model.safetensors +1 -1
config.json
CHANGED
@@ -12,5 +12,5 @@
|
|
12 |
"model_type": "embedding-head",
|
13 |
"output_size": 128,
|
14 |
"torch_dtype": "float32",
|
15 |
-
"transformers_version": "4.35.
|
16 |
}
|
|
|
12 |
"model_type": "embedding-head",
|
13 |
"output_size": 128,
|
14 |
"torch_dtype": "float32",
|
15 |
+
"transformers_version": "4.35.1"
|
16 |
}
|
model.py
CHANGED
@@ -88,6 +88,14 @@ class ZeroShotEmbeddingForClustering(PreTrainedModel):
|
|
88 |
prompted_embeddings.transpose(0, 1))
|
89 |
return similarity
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
ZeroShotEmbeddingConfig.register_for_auto_class()
|
93 |
ZeroShotEmbedding.register_for_auto_class("AutoModel")
|
|
|
88 |
prompted_embeddings.transpose(0, 1))
|
89 |
return similarity
|
90 |
|
91 |
+
@classmethod
|
92 |
+
def from_pretrained_base(cls, pretrained_model_name_or_path):
|
93 |
+
head_model = ZeroShotEmbedding.from_pretrained(
|
94 |
+
pretrained_model_name_or_path)
|
95 |
+
model = cls(head_model.config)
|
96 |
+
cls.head_model = head_model
|
97 |
+
return model
|
98 |
+
|
99 |
|
100 |
ZeroShotEmbeddingConfig.register_for_auto_class()
|
101 |
ZeroShotEmbedding.register_for_auto_class("AutoModel")
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 13640544
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:427af19366ad65a03d77feeab3e7dc1d8c4a217efd3fe97052724ea94c3ca2d0
|
3 |
size 13640544
|