Downloads · 30 days
7
2% of all-time downloads
AiresPucrs/distilbert-base-cased-sentiment-classifier
distilbert-base-cased-sentiment-classifier is a text classification model from AiresPucrs. Use it when you need a label for a piece of text. It is set up for transformers.
This model is part of a tutorial tied to the Teeny-Tiny Castle, an open-source repository containing educational tools for AI Ethics and Safety research.
Downloads · 30 days
7
2% of all-time downloads
All-time downloads
372
Public
Parameters
65.8M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.h5263 MB · 50%
From the Hugging Face model README
This model is part of a tutorial tied to the Teeny-Tiny Castle, an open-source repository containing educational tools for AI Ethics and Safety research.
from transformers import TFAutoModelForSequenceClassification, AutoTokenizer
from transformers import TextClassificationPipeline
# Load the model and tokenizer
model = TFAutoModelForSequenceClassification.from_pretrained("AiresPucrs/distilbert-base-cased-sentiment-classifier")
tokenizer = AutoTokenizer.from_pretrained("AiresPucrs/distilbert-base-cased-sentiment-classifier")
# Create a text classification pipeline
pipeline = TextClassificationPipeline(model=model, tokenizer=tokenizer)
# Classify some samples
texts = [
'Is to complicated and boring.',
'Is nice to see philosophers doing machine learning.',
]
for text in texts:
preds = pipeline(text)
print(f"""\nReview: '{text}'\n(Label: {preds[0]['label']} | Confidence: {preds[0]['score'] * 100:.2f}%)""")