Downloads · 30 days
13
13% of all-time downloads
KinSlay3rs/tweet-tone-classifier
tweet-tone-classifier is a text classification model from KinSlay3rs. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
A fine-tuned DistilBERT model for binary sentiment classification of tweets — predicts whether a tweet is Positive or Negative.
Downloads · 30 days
13
13% of all-time downloads
All-time downloads
97
Public
Parameters
67M
268 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
A fine-tuned DistilBERT model for binary sentiment classification of tweets — predicts whether a tweet is Positive or Negative.
Part of a larger project that also rewrites tweets in different tones (formal, casual, empathetic, assertive) using the Gemini API.
| Property | Details |
|---|---|
| Base model | distilbert-base-uncased |
| Task | Binary Sentiment Classification |
| Dataset | Sentiment140 (50,000 samples) |
| Training epochs | 3 |
| Batch size | 32 |
| Max token length | 64 |
| Accuracy | ~87% |
| Language | English |
pip install transformers torch
from transformers import pipeline
classifier = pipeline( "text-classification", model="KinSlay3rs/tweet-tone-classifier" )
result = classifier("I can't believe my flight got cancelled again!!") print(result)
result = classifier("Just got promoted!! Best day ever 🎉") print(result)
from transformers import DistilBertTokenizerFast, DistilBertForSequenceClassification import torch
tokenizer = DistilBertTokenizerFast.from_pretrained("KinSlay3rs/tweet-tone-classifier") model = DistilBertForSequenceClassification.from_pretrained("KinSlay3rs/tweet-tone-classifier") model.eval()
LABELS = {0: "NEGATIVE", 1: "POSITIVE"}
def predict(tweet: str) -> str: inputs = tokenizer(tweet, return_tensors="pt", truncation=True, max_length=64) with torch.no_grad(): logits = model(**inputs).logits label = LABELS[logits.argmax().item()] score = torch.softmax(logits, dim=1).max().item() return f"{label} (confidence: {score:.2f})"
print(predict("This is the worst experience I've ever had."))
print(predict("Absolutely loving the new update!"))
Trained on a 50,000 sample subset of the Sentiment140 dataset, which contains 1.6 million tweets labelled as positive or negative.
Preprocessing applied:
http://...)@username)from transformers import TrainingArguments
args = TrainingArguments( output_dir="./results", num_train_epochs=3, per_device_train_batch_size=32, eval_strategy="epoch", save_strategy="epoch", load_best_model_at_end=True, )
Hardware used: Intel i5 7th Gen CPU / Kaggle T4 GPU
Training time: ~25 minutes on GPU
xlm-roberta-baseThis model is part of the Tweet Tone Classifier & Rewriter project which includes:
🔗 GitHub: github.com/KinSlay3rS/GenAI-Projects/Sentement-Analysis-DistilBERT
🔗 Live Demo: huggingface.co/spaces/KinSlay3rs/tweet-tone-classifier
Made by KinSlay3rs
🔗 Hugging Face Profile