Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -80,10 +80,10 @@ from FlagEmbedding import FlagLLMReranker
|
|
| 80 |
reranker = FlagLLMReranker('BAAI/bge-reranker-v2-gemma', use_bf16=True) # Setting use_bf16 to True speeds up computation with a slight performance degradation
|
| 81 |
|
| 82 |
score = reranker.compute_score(['query', 'passage'])
|
| 83 |
-
print(score)
|
| 84 |
|
| 85 |
scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']])
|
| 86 |
-
print(scores)
|
| 87 |
```
|
| 88 |
|
| 89 |
#### For LLM-based layerwise reranker
|
|
@@ -93,10 +93,10 @@ from FlagEmbedding import LayerWiseFlagLLMReranker
|
|
| 93 |
reranker = LayerWiseFlagLLMReranker('BAAI/bge-reranker-v2-minicpm-layerwise', use_bf16=True) # Setting use_bf16 to True speeds up computation with a slight performance degradation
|
| 94 |
|
| 95 |
score = reranker.compute_score(['query', 'passage'], cutoff_layers=[28]) # Adjusting 'cutoff_layers' to pick which layers are used for computing the score.
|
| 96 |
-
print(score)
|
| 97 |
|
| 98 |
scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']], cutoff_layers=[28])
|
| 99 |
-
print(scores)
|
| 100 |
```
|
| 101 |
|
| 102 |
### Using Huggingface transformers
|
|
|
|
| 80 |
reranker = FlagLLMReranker('BAAI/bge-reranker-v2-gemma', use_bf16=True) # Setting use_bf16 to True speeds up computation with a slight performance degradation
|
| 81 |
|
| 82 |
score = reranker.compute_score(['query', 'passage'])
|
| 83 |
+
print(score)
|
| 84 |
|
| 85 |
scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']])
|
| 86 |
+
print(scores)
|
| 87 |
```
|
| 88 |
|
| 89 |
#### For LLM-based layerwise reranker
|
|
|
|
| 93 |
reranker = LayerWiseFlagLLMReranker('BAAI/bge-reranker-v2-minicpm-layerwise', use_bf16=True) # Setting use_bf16 to True speeds up computation with a slight performance degradation
|
| 94 |
|
| 95 |
score = reranker.compute_score(['query', 'passage'], cutoff_layers=[28]) # Adjusting 'cutoff_layers' to pick which layers are used for computing the score.
|
| 96 |
+
print(score)
|
| 97 |
|
| 98 |
scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']], cutoff_layers=[28])
|
| 99 |
+
print(scores)
|
| 100 |
```
|
| 101 |
|
| 102 |
### Using Huggingface transformers
|