nicholasKluge's picture
Update README.md
225f40f verified
metadata
tags:
  - generated_from_keras_callback
model-index:
  - name: distilbert-base-cased-sentiment-classifier
    results: []

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}%)""")