vector-institute/newsmediabias-plus
Viewer • Updated • 40.9k • 25 • 9
How to use maximuspowers/nmbp-bert-headlines-balanced with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="maximuspowers/nmbp-bert-headlines-balanced") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("maximuspowers/nmbp-bert-headlines-balanced")
model = AutoModelForSequenceClassification.from_pretrained("maximuspowers/nmbp-bert-headlines-balanced")Classifies sentences as "Likely" or "Unlikely" biased/disinformation (max token len 128).
Fine-tuned BERT (bert-base-uncased) on the headline and text_label fields in the News Media Bias Plus Dataset.
This model was trained with weighted sampling so that each batch contains 50% 'Likely' examples and 50% 'Unlikely' examples. The same model trained without weighted sampling is here, and got slightly better eval metrics. However, this model preformed better when predictions were evaluated by gpt-4o as a judge.
Evaluated on a 0.1 random sample of the NMB+ dataset, unseen during training
from transformers import pipeline
classifier = pipeline("text-classification", model="maximuspowers/nmbp-bert-headlines-balanced")
result = classifier("He was a terrible politician.", top_k=2)
[
{
'label': 'Likely',
'score': 0.9967995882034302
},
{
'label': 'Unlikely',
'score': 0.003200419945642352
}
]
Base model
google-bert/bert-base-uncased