mediabiasgroup/BABE
Viewer • Updated • 4.12k • 764 • 4
How to use vulonviing/roberta-babe-baseline with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="vulonviing/roberta-babe-baseline") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("vulonviing/roberta-babe-baseline")
model = AutoModelForSequenceClassification.from_pretrained("vulonviing/roberta-babe-baseline")Best-fold checkpoint from a 5-fold RoBERTa-base reproduction of BABE sentence-level media bias classification.
models/fold_0/checkpoint-532fold_0 with macro-F1 0.8760.857 +- 0.012| Item | Value |
|---|---|
| Base model | roberta-base |
| Task | Sentence-level media bias classification |
| Labels | non-biased, biased |
| Max sequence length | 128 |
| Epochs | 4 |
| Learning rate | 2e-05 |
| Batch size | 16 train / 32 eval |
| Weight decay | 0.01 |
| Warmup ratio | 0.1 |
| Random seed | 42 |
| Metric | Mean +- Std |
|---|---|
| Macro-F1 | 0.857 +- 0.012 |
| Accuracy | 0.858 +- 0.012 |
| Precision (macro) | 0.856 +- 0.011 |
| Recall (macro) | 0.859 +- 0.012 |
| Biased F1 | 0.869 +- 0.011 |
Per-fold macro-F1 values in the repo: 0.876, 0.854, 0.845, 0.852, 0.856.
| Metric | Score |
|---|---|
| Macro-F1 | 0.870 |
| Accuracy | 0.872 |
| Precision (macro) | 0.870 |
| Recall (macro) | 0.872 |
| Biased F1 | 0.884 |
Confusion matrix from the held-out quick run (n=468):
| Pred non-biased | Pred biased | |
|---|---|---|
| True non-biased (207) | 180 | 27 |
| True biased (261) | 33 | 228 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
repo_id = 'vulonviing/roberta-babe-baseline'
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSequenceClassification.from_pretrained(repo_id)
Base model
FacebookAI/roberta-base