SpirinEgor
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -91,11 +91,12 @@ with torch.no_grad():
|
|
91 |
# Perform pooling. In this case, cls pooling.
|
92 |
sentence_embeddings = model_output[0][:, 0]
|
93 |
|
94 |
-
|
95 |
# normalize embeddings
|
96 |
-
sentence_embeddings = torch.nn.functional.normalize(sentence_embeddings, p=2, dim=1)
|
97 |
-
|
98 |
-
# [0.
|
|
|
|
|
99 |
```
|
100 |
|
101 |
Also, you can use native [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding) library for evaluation. Usage is described in [`bge-m3` model card](https://huggingface.co/BAAI/bge-m3).
|
|
|
91 |
# Perform pooling. In this case, cls pooling.
|
92 |
sentence_embeddings = model_output[0][:, 0]
|
93 |
|
|
|
94 |
# normalize embeddings
|
95 |
+
sentence_embeddings = torch.nn.functional.normalize(sentence_embeddings, p=2, dim=1)
|
96 |
+
|
97 |
+
# [[0.5567, 0.3014],
|
98 |
+
# [0.1701, 0.7122]]
|
99 |
+
scores = (sentence_embeddings[:2] @ sentence_embeddings[2:].T)
|
100 |
```
|
101 |
|
102 |
Also, you can use native [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding) library for evaluation. Usage is described in [`bge-m3` model card](https://huggingface.co/BAAI/bge-m3).
|