Text Classification
sentence-transformers
Safetensors
Transformers
multilingual
xlm-roberta
text-embeddings-inference
Instructions to use BAAI/bge-reranker-v2-m3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use BAAI/bge-reranker-v2-m3 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("BAAI/bge-reranker-v2-m3") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Transformers
How to use BAAI/bge-reranker-v2-m3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="BAAI/bge-reranker-v2-m3")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("BAAI/bge-reranker-v2-m3") model = AutoModelForSequenceClassification.from_pretrained("BAAI/bge-reranker-v2-m3") - Inference
- Notebooks
- Google Colab
- Kaggle
Is bge-reranker-v2-m3 pointwise, listwise, or pairwise methods?
#31
by Rebecca19990101 - opened
Is bge-reranker-v2-m3 pointwise, listwise, or pairwise methods?
You should pass the query and document to the model at the same time, and it will produce a score for how closely the document relates to the query.
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.']], normalize=True)
print(scores) # [0.00027803096387751553, 0.9948403768236574]
