Given a question and paragraph, can the question be answered by the paragraph? The models have been trained on the
GLUE QNLI
dataset, which transformed the
SQuAD dataset
into an NLI task.
from sentence_transformers import CrossEncoder
model = CrossEncoder('model_name')
scores = model.predict([('Query1', 'Paragraph1'), ('Query2', 'Paragraph2')])
#e.g.
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.'), ('What is the size of New York?', 'New York City is famous for the Metropolitan Museum of Art.')])
Usage with Transformers AutoModel
You can use the model also directly with Transformers library (without SentenceTransformers library):
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model = AutoModelForSequenceClassification.from_pretrained('model_name')
tokenizer = AutoTokenizer.from_pretrained('model_name')
features = tokenizer(['How many people live in Berlin?', 'What is the size of New York?'], ['Berlin had a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.', 'New York City is famous for the Metropolitan Museum of Art.'], padding=True, truncation=True, return_tensors="pt")
model.eval()
with torch.no_grad():
scores = torch.nn.functional.sigmoid(model(**features).logits)
print(scores)
Runs of cross-encoder qnli-electra-base on huggingface.co
3.5K
Total runs
0
24-hour runs
393
3-day runs
912
7-day runs
731
30-day runs
More Information About qnli-electra-base huggingface.co Model
qnli-electra-base huggingface.co is an AI model on huggingface.co that provides qnli-electra-base's model effect (), which can be used instantly with this cross-encoder qnli-electra-base model. huggingface.co supports a free trial of the qnli-electra-base model, and also provides paid use of the qnli-electra-base. Support call qnli-electra-base model through api, including Node.js, Python, http.
qnli-electra-base huggingface.co is an online trial and call api platform, which integrates qnli-electra-base's modeling effects, including api services, and provides a free online trial of qnli-electra-base, you can try qnli-electra-base online for free by clicking the link below.
cross-encoder qnli-electra-base online free url in huggingface.co:
qnli-electra-base is an open source model from GitHub that offers a free installation service, and any user can find qnli-electra-base on GitHub to install. At the same time, huggingface.co provides the effect of qnli-electra-base install, users can directly use qnli-electra-base installed effect in huggingface.co for debugging and trial. It also supports api for free installation.