Views
No views yet
mteb/tweet_sentiment_extraction dataset to classify tweets into three sentiment categories: Positive, Neutral, and Negative. It uses the Hugging Face Transformers library and achieves an evaluation accuracy of 76%.mteb/tweet_sentiment_extraction1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load the model and tokenizer
5tokenizer = AutoTokenizer.from_pretrained("charlie1898/gpt2_finetuned_twitter_sentiment_analysis")
6model = AutoModelForSequenceClassification.from_pretrained("charlie1898/gpt2_finetuned_twitter_sentiment_analysis")
7
8# Example input
9text = "I love using Hugging Face models!"
10inputs = tokenizer(text, return_tensors="pt")
11outputs = model(**inputs)
12predicted_class = torch.argmax(outputs.logits).item()
13print(f"Predicted sentiment class: {predicted_class}")
14
15# Limitations
16- ** Bias **: The dataset may contain biased or harmful text, potentially influencing predictions.
17- ** Domain Limitations **: Optimized for English tweets; performance may degrade on other text types or languages.
18
19# Ethical Considerations
20This model should be used responsibly. Be aware of biases in the training data and avoid deploying the model in sensitive or high-stakes applications without further validation.
21
22# Acknowledgments
23- Hugging Face Transformers library
24- mteb/tweet_sentiment_extraction dataset