The model can be used as a reranker in a 2-stage "retrieve-rerank" pipeline, where it reorders passages returned by a retriever model (e.g. an embedding model or BM25) given some query. See
SBERT.net Retrieve & Re-rank
for more details.
from sentence_transformers import CrossEncoder
model = CrossEncoder("cross-encoder/monoelectra-large", trust_remote_code=True)
scores = model.predict([
("How many people live in Berlin?", "Berlin had a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers."),
("How many people live in Berlin?", "Berlin is well known for its museums."),
])
print(scores)
# [ 6.016401 -3.6922567]
Usage with Transformers
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model = AutoModelForSequenceClassification.from_pretrained("cross-encoder/monoelectra-large", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("cross-encoder/monoelectra-large")
features = tokenizer(
[
("How many people live in Berlin?", "Berlin had a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers."),
("How many people live in Berlin?", "Berlin is well known for its museums."),
],
padding=True,
truncation=True,
return_tensors="pt",
)
model.eval()
with torch.no_grad():
scores = model(**features).logits.view(-1)
print(scores)
# tensor([ 6.0164, -3.6923])
Runs of cross-encoder monoelectra-large on huggingface.co
43
Total runs
0
24-hour runs
-10
3-day runs
-28
7-day runs
-39
30-day runs
More Information About monoelectra-large huggingface.co Model
monoelectra-large huggingface.co is an AI model on huggingface.co that provides monoelectra-large's model effect (), which can be used instantly with this cross-encoder monoelectra-large model. huggingface.co supports a free trial of the monoelectra-large model, and also provides paid use of the monoelectra-large. Support call monoelectra-large model through api, including Node.js, Python, http.
monoelectra-large huggingface.co is an online trial and call api platform, which integrates monoelectra-large's modeling effects, including api services, and provides a free online trial of monoelectra-large, you can try monoelectra-large online for free by clicking the link below.
cross-encoder monoelectra-large online free url in huggingface.co:
monoelectra-large is an open source model from GitHub that offers a free installation service, and any user can find monoelectra-large on GitHub to install. At the same time, huggingface.co provides the effect of monoelectra-large install, users can directly use monoelectra-large installed effect in huggingface.co for debugging and trial. It also supports api for free installation.