from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch

Load the model and tokenizer

tokenizer = AutoTokenizer.from_pretrained("charlie1898/gpt2_finetuned_twitter_sentiment_analysis") model = AutoModelForSequenceClassification.from_pretrained("charlie1898/gpt2_finetuned_twitter_sentiment_analysis")

Example input

text = "I love using Hugging Face models!" inputs = tokenizer(text, return_tensors="pt") outputs = model(**inputs) predicted_class = torch.argmax(outputs.logits).item() print(f"Predicted sentiment class: {predicted_class}")

Limitations

  • ** Bias **: The dataset may contain biased or harmful text, potentially influencing predictions.
  • ** Domain Limitations **: Optimized for English tweets; performance may degrade on other text types or languages.

Ethical Considerations

This 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.

Acknowledgments

  • Hugging Face Transformers library
  • mteb/tweet_sentiment_extraction dataset
Downloads last month
4
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support