DistilBERT Sentiment Classifier (Teeny-Tiny Castle)
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.
How to Use
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}%)""")
- Downloads last month
- 14
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.