File size: 1,207 Bytes
130d1ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0c06b9c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
license: mit
---
### Dataset used 
[Fake and real news dataset](https://www.kaggle.com/datasets/clmentbisaillon/fake-and-real-news-dataset)

### Labels
Fake news: 1 </br>
Real news: 0 

### Usage 
```python
from transformers import AutoModelForSequenceClassification, AutoTokenizer, AutoConfig
import torch

config = AutoConfig.from_pretrained("bhavitvyamalik/fake-news_xtremedistil-l6-h256-uncased")
model = AutoModelForSequenceClassification.from_pretrained("bhavitvyamalik/fake-news_xtremedistil-l6-h256-uncased", config=config)
tokenizer = AutoTokenizer.from_pretrained("microsoft/xtremedistil-l6-h256-uncased", usefast=True)

text = "According to reports by Fox News, Biden is the President of the USA"
encode = tokenizer(text, max_length=512, truncation=True, padding="max_length", return_tensors="pt")

output = model(**encode)
print(torch.argmax(output["logits"]))
```

### Performance on test data 
```json
'test/accuracy': 0.9977836608886719,
'test/aucroc': 0.9999998807907104,
'test/f1': 0.9976308941841125,
'test/loss': 0.00828308891505003
```

### Run can be tracked here
[Wandb project for Fake news classifier](https://wandb.ai/bhavitvya/Fake%20news%20classifier?workspace=user-bhavitvya)