Text Classification
Transformers
TensorFlow
Safetensors
distilbert
generated_from_keras_callback
text-embeddings-inference
Instructions to use AiresPucrs/distilbert-base-cased-sentiment-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AiresPucrs/distilbert-base-cased-sentiment-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="AiresPucrs/distilbert-base-cased-sentiment-classifier")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("AiresPucrs/distilbert-base-cased-sentiment-classifier") model = AutoModelForSequenceClassification.from_pretrained("AiresPucrs/distilbert-base-cased-sentiment-classifier") - Notebooks
- Google Colab
- Kaggle
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
- 2