Zero-Shot Classification
sentence-transformers
PyTorch
JAX
ONNX
Safetensors
OpenVINO
Transformers
English
roberta
text-classification
Instructions to use cross-encoder/nli-distilroberta-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use cross-encoder/nli-distilroberta-base with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("cross-encoder/nli-distilroberta-base") 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 cross-encoder/nli-distilroberta-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-classification", model="cross-encoder/nli-distilroberta-base")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("cross-encoder/nli-distilroberta-base") model = AutoModelForSequenceClassification.from_pretrained("cross-encoder/nli-distilroberta-base") - Notebooks
- Google Colab
- Kaggle
Update model metadata
Browse files
README.md
CHANGED
|
@@ -2,13 +2,16 @@
|
|
| 2 |
language: en
|
| 3 |
pipeline_tag: zero-shot-classification
|
| 4 |
tags:
|
| 5 |
-
-
|
| 6 |
datasets:
|
| 7 |
-
- multi_nli
|
| 8 |
-
- snli
|
| 9 |
metrics:
|
| 10 |
- accuracy
|
| 11 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
# Cross-Encoder for Natural Language Inference
|
|
@@ -63,4 +66,4 @@ sent = "Apple just announced the newest iPhone X"
|
|
| 63 |
candidate_labels = ["technology", "sports", "politics"]
|
| 64 |
res = classifier(sent, candidate_labels)
|
| 65 |
print(res)
|
| 66 |
-
```
|
|
|
|
| 2 |
language: en
|
| 3 |
pipeline_tag: zero-shot-classification
|
| 4 |
tags:
|
| 5 |
+
- transformers
|
| 6 |
datasets:
|
| 7 |
+
- nyu-mll/multi_nli
|
| 8 |
+
- stanfordnlp/snli
|
| 9 |
metrics:
|
| 10 |
- accuracy
|
| 11 |
license: apache-2.0
|
| 12 |
+
base_model:
|
| 13 |
+
- distilbert/distilroberta-base
|
| 14 |
+
library_name: sentence-transformers
|
| 15 |
---
|
| 16 |
|
| 17 |
# Cross-Encoder for Natural Language Inference
|
|
|
|
| 66 |
candidate_labels = ["technology", "sports", "politics"]
|
| 67 |
res = classifier(sent, candidate_labels)
|
| 68 |
print(res)
|
| 69 |
+
```
|