Text Ranking
sentence-transformers
Safetensors
Transformers
new
text-classification
text-embeddings-inference
custom_code
Instructions to use Alibaba-NLP/gte-multilingual-reranker-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Alibaba-NLP/gte-multilingual-reranker-base with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("Alibaba-NLP/gte-multilingual-reranker-base", trust_remote_code=True) query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Transformers
How to use Alibaba-NLP/gte-multilingual-reranker-base with Transformers:
# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("Alibaba-NLP/gte-multilingual-reranker-base", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
infinity usage of reranking. Implements a cohere compatible api.
#10
by michaelfeil - opened
README.md
CHANGED
|
@@ -126,6 +126,14 @@ with torch.no_grad():
|
|
| 126 |
# tensor([1.2315, 0.5923, 0.3041])
|
| 127 |
```
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
## Evaluation
|
| 131 |
|
|
|
|
| 126 |
# tensor([1.2315, 0.5923, 0.3041])
|
| 127 |
```
|
| 128 |
|
| 129 |
+
Usage with infinity:
|
| 130 |
+
|
| 131 |
+
[Infinity](https://github.com/michaelfeil/infinity), a MIT Licensed Inference RestAPI Server.
|
| 132 |
+
```
|
| 133 |
+
docker run --gpus all -v $PWD/data:/app/.cache -p "7997":"7997" \
|
| 134 |
+
michaelf34/infinity:0.0.68 \
|
| 135 |
+
v2 --model-id Alibaba-NLP/gte-multilingual-reranker-base --revision "main" --dtype bfloat16 --batch-size 32 --device cuda --engine torch --port 7997
|
| 136 |
+
```
|
| 137 |
|
| 138 |
## Evaluation
|
| 139 |
|