Update README.md
Browse files
README.md
CHANGED
@@ -77,20 +77,18 @@ from sentence_transformers import SentenceTransformer
|
|
77 |
|
78 |
# Download from the 🤗 Hub
|
79 |
model = SentenceTransformer("pkshatech/GLuCoSE-base-ja-v2")
|
80 |
-
|
|
|
81 |
sentences = [
|
82 |
-
'
|
83 |
-
|
84 |
-
'He drove to the stadium.',
|
85 |
]
|
86 |
embeddings = model.encode(sentences)
|
87 |
print(embeddings.shape)
|
88 |
-
# [
|
89 |
|
90 |
# Get the similarity scores for the embeddings
|
91 |
-
similarities =
|
92 |
-
print(similarities.shape)
|
93 |
-
# [3, 3]
|
94 |
```
|
95 |
|
96 |
<!--
|
|
|
77 |
|
78 |
# Download from the 🤗 Hub
|
79 |
model = SentenceTransformer("pkshatech/GLuCoSE-base-ja-v2")
|
80 |
+
|
81 |
+
# Don't forget to add the prefix "query: " for query-side or "passage: " for passage-side texts.
|
82 |
sentences = [
|
83 |
+
'query: PKSHAはどんな会社ですか?'
|
84 |
+
'passage: 研究開発したアルゴリズムを、多くの企業のソフトウエア・オペレーションに導入しています。'
|
|
|
85 |
]
|
86 |
embeddings = model.encode(sentences)
|
87 |
print(embeddings.shape)
|
88 |
+
# [2, 768]
|
89 |
|
90 |
# Get the similarity scores for the embeddings
|
91 |
+
similarities = F.cosine_similarity(embeddings.unsqueeze(0), embeddings.unsqueeze(1), dim=2)
|
|
|
|
|
92 |
```
|
93 |
|
94 |
<!--
|