cross-encoder / nli-distilroberta-base

huggingface.co
Total runs: 13.0K
24-hour runs: -984
7-day runs: -2.2K
30-day runs: 1.0K
Model's Last Updated: Dezember 12 2024
zero-shot-classification

Introduction of nli-distilroberta-base

Model Details of nli-distilroberta-base

Cross-Encoder for Natural Language Inference

This model was trained using SentenceTransformers Cross-Encoder class.

Training Data

The model was trained on the SNLI and MultiNLI datasets. For a given sentence pair, it will output three scores corresponding to the labels: contradiction, entailment, neutral.

Performance

For evaluation results, see SBERT.net - Pretrained Cross-Encoder .

Usage

Pre-trained models can be used like this:

from sentence_transformers import CrossEncoder
model = CrossEncoder('cross-encoder/nli-distilroberta-base')
scores = model.predict([('A man is eating pizza', 'A man eats something'), ('A black race car starts up in front of a crowd of people.', 'A man is driving down a lonely road.')])

#Convert scores to labels
label_mapping = ['contradiction', 'entailment', 'neutral']
labels = [label_mapping[score_max] for score_max in scores.argmax(axis=1)]
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('cross-encoder/nli-distilroberta-base')
tokenizer = AutoTokenizer.from_pretrained('cross-encoder/nli-distilroberta-base')

features = tokenizer(['A man is eating pizza', 'A black race car starts up in front of a crowd of people.'], ['A man eats something', 'A man is driving down a lonely road.'],  padding=True, truncation=True, return_tensors="pt")

model.eval()
with torch.no_grad():
    scores = model(**features).logits
    label_mapping = ['contradiction', 'entailment', 'neutral']
    labels = [label_mapping[score_max] for score_max in scores.argmax(dim=1)]
    print(labels)
Zero-Shot Classification

This model can also be used for zero-shot-classification:

from transformers import pipeline

classifier = pipeline("zero-shot-classification", model='cross-encoder/nli-distilroberta-base')

sent = "Apple just announced the newest iPhone X"
candidate_labels = ["technology", "sports", "politics"]
res = classifier(sent, candidate_labels)
print(res)

Runs of cross-encoder nli-distilroberta-base on huggingface.co

13.0K
Total runs
-984
24-hour runs
-871
3-day runs
-2.2K
7-day runs
1.0K
30-day runs

More Information About nli-distilroberta-base huggingface.co Model

More nli-distilroberta-base license Visit here:

https://choosealicense.com/licenses/apache-2.0

nli-distilroberta-base huggingface.co

nli-distilroberta-base huggingface.co is an AI model on huggingface.co that provides nli-distilroberta-base's model effect (), which can be used instantly with this cross-encoder nli-distilroberta-base model. huggingface.co supports a free trial of the nli-distilroberta-base model, and also provides paid use of the nli-distilroberta-base. Support call nli-distilroberta-base model through api, including Node.js, Python, http.

nli-distilroberta-base huggingface.co Url

https://huggingface.co/cross-encoder/nli-distilroberta-base

cross-encoder nli-distilroberta-base online free

nli-distilroberta-base huggingface.co is an online trial and call api platform, which integrates nli-distilroberta-base's modeling effects, including api services, and provides a free online trial of nli-distilroberta-base, you can try nli-distilroberta-base online for free by clicking the link below.

cross-encoder nli-distilroberta-base online free url in huggingface.co:

https://huggingface.co/cross-encoder/nli-distilroberta-base

nli-distilroberta-base install

nli-distilroberta-base is an open source model from GitHub that offers a free installation service, and any user can find nli-distilroberta-base on GitHub to install. At the same time, huggingface.co provides the effect of nli-distilroberta-base install, users can directly use nli-distilroberta-base installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

nli-distilroberta-base install url in huggingface.co:

https://huggingface.co/cross-encoder/nli-distilroberta-base

Url of nli-distilroberta-base

nli-distilroberta-base huggingface.co Url

Provider of nli-distilroberta-base huggingface.co

cross-encoder
ORGANIZATIONS

Other API from cross-encoder