cardiffnlp/tweet_eval
Viewer β’ Updated β’ 201k β’ 39.6k β’ 144
A fine-tuned FLAN-T5 Large model for stance classification of tweets related to COVID-19 vaccines. It outputs one of three stance categories:
This model builds on FLAN-T5-Large using two-stage fine-tuning:
cardiffnlp/tweet_eval to teach emotional polarity..csv), augmented for balance and stratified across splits.Instruction-tuning + prompt-based generation was retained from the original FLAN-T5 formulation.
| Metric | Score |
|---|---|
| Macro F1 | 0.93 |
| Micro F1 | 0.94 |
Evaluation was conducted across a 5732-tweet dataset split 80:10:10 (train:test:val). The model showed consistent generalization and balanced performance across all splits.
from transformers import T5ForConditionalGeneration, T5Tokenizer
model = T5ForConditionalGeneration.from_pretrained("DopplerEffect/vaccineStance-flan-t5-large")
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
prompt = '''
You are a sentiment analyst tasked with understanding public opinion about COVID-19 on Twitter. Your job is to classify the sentiment of each tweet as one of the following categories:
- in-favor: The tweet expresses positive support or agreement regarding COVID-19 policies, vaccines, or public health advice.
- against: The tweet expresses opposition, criticism, or distrust of COVID-19-related efforts.
- neutral-or-unclear: The tweet neither clearly supports nor opposes, or the sentiment is ambiguous.
Tweet: "Vaccines saved so many lives!"
Sentiment:
'''
outputMap = {
"positive":"in-favor",
"negative":"against",
"neutral":"neutral-or-unclear"
}
inputIds = self.tokenizer(prompt, return_tensors="pt").input_ids # The tweet is enclosed in the prompt
output = self.model.generate(inputIds)
prediction = outputMap.get(self.tokenizer.decode(output[0], skip_special_tokens=True).strip())
print(prediction) # Output: in-favor