Dang Phuong Nam
commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -50,22 +50,31 @@ from FlagEmbedding import FlagReranker
|
|
| 50 |
reranker = FlagReranker('namdp/bge-reranker-vietnamese',
|
| 51 |
use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
|
| 52 |
|
| 53 |
-
score = reranker.compute_score(['
|
| 54 |
-
print(score) #
|
| 55 |
|
| 56 |
# You can map the scores into 0-1 by set "normalize=True", which will apply sigmoid function to the score
|
| 57 |
-
score = reranker.compute_score(['
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
# You can map the scores into 0-1 by set "normalize=True", which will apply sigmoid function to the score
|
| 65 |
-
scores = reranker.compute_score(
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
```
|
| 70 |
|
| 71 |
### Using Huggingface transformers
|
|
|
|
| 50 |
reranker = FlagReranker('namdp/bge-reranker-vietnamese',
|
| 51 |
use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
|
| 52 |
|
| 53 |
+
score = reranker.compute_score(['tỉnh nào có diện tích lớn nhất việt nam', 'nghệ an có diện tích lớn nhất việt nam'])
|
| 54 |
+
print(score) # 11.140625
|
| 55 |
|
| 56 |
# You can map the scores into 0-1 by set "normalize=True", which will apply sigmoid function to the score
|
| 57 |
+
score = reranker.compute_score(['tỉnh nào có diện tích lớn nhất việt nam', 'nghệ an có diện tích lớn nhất việt nam'],
|
| 58 |
+
normalize=True)
|
| 59 |
+
print(score) # 0.9999854895214452
|
| 60 |
+
|
| 61 |
+
scores = reranker.compute_score(
|
| 62 |
+
[
|
| 63 |
+
['tỉnh nào có diện tích lớn nhất việt nam', 'nghệ an có diện tích lớn nhất việt nam'],
|
| 64 |
+
['tỉnh nào có diện tích lớn nhất việt nam', 'bắc ninh có diện tích nhỏ nhất việt nam']
|
| 65 |
+
]
|
| 66 |
+
)
|
| 67 |
+
print(scores) # [11.140625, -1.58203125]
|
| 68 |
|
| 69 |
# You can map the scores into 0-1 by set "normalize=True", which will apply sigmoid function to the score
|
| 70 |
+
scores = reranker.compute_score(
|
| 71 |
+
[
|
| 72 |
+
['tỉnh nào có diện tích lớn nhất việt nam', 'nghệ an có diện tích lớn nhất việt nam'],
|
| 73 |
+
['tỉnh nào có diện tích lớn nhất việt nam', 'bắc ninh có diện tích nhỏ nhất việt nam']
|
| 74 |
+
],
|
| 75 |
+
normalize=True
|
| 76 |
+
)
|
| 77 |
+
print(scores) # [0.99998548952144523, 0.17050799982688053]
|
| 78 |
```
|
| 79 |
|
| 80 |
### Using Huggingface transformers
|