Update README.md
Browse files
README.md
CHANGED
@@ -3,6 +3,7 @@ tags:
|
|
3 |
- mteb
|
4 |
- sentence-similarity
|
5 |
- sentence-transformers
|
|
|
6 |
model-index:
|
7 |
- name: gte-small
|
8 |
results:
|
@@ -2637,7 +2638,7 @@ We compared the performance of the GTE models with other popular text embedding
|
|
2637 |
|
2638 |
Code example
|
2639 |
|
2640 |
-
```
|
2641 |
import torch.nn.functional as F
|
2642 |
from torch import Tensor
|
2643 |
from transformers import AutoTokenizer, AutoModel
|
@@ -2669,6 +2670,18 @@ scores = (embeddings[:1] @ embeddings[1:].T) * 100
|
|
2669 |
print(scores.tolist())
|
2670 |
```
|
2671 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2672 |
### Limitation
|
2673 |
|
2674 |
This model exclusively caters to English texts, and any lengthy texts will be truncated to a maximum of 512 tokens.
|
|
|
3 |
- mteb
|
4 |
- sentence-similarity
|
5 |
- sentence-transformers
|
6 |
+
- Sentence Transformers
|
7 |
model-index:
|
8 |
- name: gte-small
|
9 |
results:
|
|
|
2638 |
|
2639 |
Code example
|
2640 |
|
2641 |
+
```python
|
2642 |
import torch.nn.functional as F
|
2643 |
from torch import Tensor
|
2644 |
from transformers import AutoTokenizer, AutoModel
|
|
|
2670 |
print(scores.tolist())
|
2671 |
```
|
2672 |
|
2673 |
+
Use with sentence-transformers:
|
2674 |
+
```python
|
2675 |
+
from sentence_transformers import SentenceTransformer
|
2676 |
+
from sentence_transformers.util import cos_sim
|
2677 |
+
|
2678 |
+
sentences = ['That is a happy person', 'That is a very happy person']
|
2679 |
+
|
2680 |
+
model = SentenceTransformer('thenlper/gte-large')
|
2681 |
+
embeddings = model.encode(sentences)
|
2682 |
+
print(cos_sim(embeddings[0], embeddings[1]))
|
2683 |
+
```
|
2684 |
+
|
2685 |
### Limitation
|
2686 |
|
2687 |
This model exclusively caters to English texts, and any lengthy texts will be truncated to a maximum of 512 tokens.
|