How to use from the
Use from the
sentence-transformers library
from sentence_transformers import CrossEncoder

model = CrossEncoder("Xenova/bge-reranker-base")

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)

https://huggingface.co/BAAI/bge-reranker-base with ONNX weights to be compatible with Transformers.js.

Usage (Transformers.js)

If you haven't already, you can install the Transformers.js JavaScript library from NPM using:

npm i @huggingface/transformers

Example: Text classification using a reranker model.

import { pipeline } from '@huggingface/transformers';

const classifier = await pipeline('text-classification', 'Xenova/bge-reranker-base');
const output = await classifier('I love transformers!');

Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using ๐Ÿค— Optimum and structuring your repo like this one (with ONNX weights located in a subfolder named onnx).

Downloads last month
6,936
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Xenova/bge-reranker-base

Quantized
(20)
this model

Spaces using Xenova/bge-reranker-base 2