cardiffnlp/tweet_eval
Viewer • Updated • 201k • 41.5k • 144
How to use giovannibonisoli/sentiment-model with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="giovannibonisoli/sentiment-model") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("giovannibonisoli/sentiment-model")
model = AutoModelForSequenceClassification.from_pretrained("giovannibonisoli/sentiment-model")Fine-tuned RoBERTa model for sentiment analysis on tweets, trained on the TweetEval benchmark.
This model can be used for sentiment analysis on English tweets. It classifies text into three categories:
Users should be aware that this model is specifically trained on tweets and may not perform well on other types of text. For production use, consider fine-tuning on domain-specific data.
from transformers import pipeline
classifier = pipeline("sentiment-analysis", model="giovannibonisoli/sentiment-model")
result = classifier("I love this!")
# [{'label': 'positive', 'score': 0.98}]
TRAIN_SAMPLES env var)VALIDATION_SAMPLES env var)NUM_EPOCHS)TrainingArguments(
num_train_epochs=3,
per_device_train_batch_size=16,
per_device_eval_batch_size=16,
eval_strategy="epoch",
save_strategy="epoch",
load_best_model_at_end=True,
metric_for_best_model="macro_f1",
logging_steps=50
)
Final metrics after training: