Text Ranking
sentence-transformers
Safetensors
Transformers
xlm-roberta
text-classification
Generated from Trainer
text-embeddings-inference
Instructions to use netandreus/bge-reranker-v2-m3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use netandreus/bge-reranker-v2-m3 with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("netandreus/bge-reranker-v2-m3") 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 netandreus/bge-reranker-v2-m3 with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("netandreus/bge-reranker-v2-m3") model = AutoModelForSequenceClassification.from_pretrained("netandreus/bge-reranker-v2-m3") - Notebooks
- Google Colab
- Kaggle
Reranker model
Brief information
This repository contains reranker model bge-reranker-v2-m3 which you can run on HuggingFace Inference Endpoints.
- Base model: BAAI/bge-reranker-v2-m3 with no any fine tune.
- Commit: 953dc6f6f85a1b2dbfca4c34a2796e7dde08d41e
More details please refer to the repo of bse model.
Supporting architectures
- Apple Silicon MPS
- Nvidia GPU
- HuggingFace Inference Endpoints (AWS)
- CPU (Intel Sapphire Rapids, 4 vCPU, 8 Gb)
- GPU (Nvidia T4)
- Infernia 2 (2 cores, 32 Gb RAM)
Example usage
HuggingFace Inference Endpoints
⚠️ When you will deploy this model in HuggingFace Inference endpoints plese select Settings -> Advanced settings -> Task: Sentence Similarity
curl "https://xxxxxxx.us-east-1.aws.endpoints.huggingface.cloud" \
-X POST \
-H "Accept: application/json" \
-H "Authorization: Bearer hf_yyyyyyy" \
-H "Content-Type: application/json" \
-d '{
"inputs": {
"source_sentence": "Hello, world!",
"sentences": [
"Hello! How are you?",
"Cats and dogs",
"The sky is blue"
]
},
"normalize": true
}'
Local inference
from FlagEmbedding import FlagReranker
class RerankRequest(BaseModel):
query: str
documents: list[str]
# Prepare array
arr = []
for element in request.documents:
arr.append([request.query, element])
print(arr)
# Inference
reranker = FlagReranker('netandreus/bge-reranker-v2-m3', use_fp16=True)
scores = reranker.compute_score(arr, normalize=True)
if not isinstance(scores, list):
scores = [scores]
print(scores) # [-8.1875, 5.26171875]
- Downloads last month
- 14
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support
Model tree for netandreus/bge-reranker-v2-m3
Base model
BAAI/bge-reranker-v2-m3