Downloads · 30 days
14
2% of all-time downloads
netandreus/bge-reranker-v2-m3
bge-reranker-v2-m3 is a text ranking model from netandreus. Use it for the text ranking task on the model card, and read the license before you ship it in a product. It is set up for sentence-transformers. The card lists the license as mit.
- Reranker model - Brief information - Supporting architectures - Example usage - HuggingFace Inference Endpoints - Local inference
Downloads · 30 days
14
2% of all-time downloads
All-time downloads
757
Public
Parameters
568M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.3 GB · 99%
From the Hugging Face model README
This repository contains reranker model bge-reranker-v2-m3 which you can run on HuggingFace Inference Endpoints.
More details please refer to the repo of bse model.
⚠️ 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
}'
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]