Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
tags:
|
| 5 |
+
- text-classification
|
| 6 |
+
- fake-news-detection
|
| 7 |
+
- transformer-ensemble
|
| 8 |
+
- bert
|
| 9 |
+
- deberta
|
| 10 |
+
library_name: transformers
|
| 11 |
+
datasets:
|
| 12 |
+
- custom
|
| 13 |
+
model_name: BertAndDeberta
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# BertAndDeberta — Transformer Ensemble for Fake News Detection
|
| 17 |
+
|
| 18 |
+
This repository hosts a fine-tuned transformer ensemble model that combines **BERT** and **DeBERTa** for binary **fake news classification**. The model was trained on a custom-labeled dataset containing real and fake news articles sourced from Kaggle and Hugging Face datasets.
|
| 19 |
+
|
| 20 |
+
## Model Details
|
| 21 |
+
|
| 22 |
+
- **Architecture**: Ensemble of BERT-base and DeBERTa-base
|
| 23 |
+
- **Task**: Binary Text Classification (`REAL` vs `FAKE`)
|
| 24 |
+
- **Training Framework**: PyTorch using 🤗 Transformers
|
| 25 |
+
- **License**: MIT
|
| 26 |
+
|
| 27 |
+
## Dataset
|
| 28 |
+
|
| 29 |
+
The dataset is a custom collection combining:
|
| 30 |
+
- News content (title + body)
|
| 31 |
+
- Labels: `0 = FAKE`, `1 = REAL`
|
| 32 |
+
|
| 33 |
+
## Usage
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 37 |
+
|
| 38 |
+
tokenizer = AutoTokenizer.from_pretrained("fauxNeuz/BertAndDeberta")
|
| 39 |
+
model = AutoModelForSequenceClassification.from_pretrained("fauxNeuz/BertAndDeberta")
|
| 40 |
+
|
| 41 |
+
text = "Government confirms policy updates in healthcare sector."
|
| 42 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 43 |
+
outputs = model(**inputs)
|
| 44 |
+
pred = outputs.logits.argmax(dim=-1).item()
|
| 45 |
+
print("REAL" if pred == 1 else "FAKE")
|