Text Classification
Transformers
PyTorch
TensorFlow
Rust
ONNX
Safetensors
English
distilbert
Eval Results (legacy)
Instructions to use distilbert/distilbert-base-uncased-finetuned-sst-2-english with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use distilbert/distilbert-base-uncased-finetuned-sst-2-english with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="distilbert/distilbert-base-uncased-finetuned-sst-2-english")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased-finetuned-sst-2-english") model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased-finetuned-sst-2-english", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Change loaded mode to correct on that this model card refers to (#26)
Browse files- Change loaded mode to correct on that this model card refers to (6a50985739210b7567055a1414bf2449cc241c1b)
Co-authored-by: Tobias Lindenbauer <Liqs@users.noreply.huggingface.co>
README.md
CHANGED
|
@@ -141,8 +141,8 @@ Example of single-label classification:
|
|
| 141 |
import torch
|
| 142 |
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
| 143 |
|
| 144 |
-
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
|
| 145 |
-
model = DistilBertForSequenceClassification.from_pretrained("distilbert-base-uncased")
|
| 146 |
|
| 147 |
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
|
| 148 |
with torch.no_grad():
|
|
|
|
| 141 |
import torch
|
| 142 |
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
| 143 |
|
| 144 |
+
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")
|
| 145 |
+
model = DistilBertForSequenceClassification.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")
|
| 146 |
|
| 147 |
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
|
| 148 |
with torch.no_grad():
|