Downloads · 30 days
9
2% of all-time downloads
rematchka/Bert_fake_news_detection
Bert_fake_news_detection is a machine learning model from rematchka. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This model is Part of the NLP assignment for Fatima Fellowship.
Downloads · 30 days
9
2% of all-time downloads
All-time downloads
483
Public
Repo size
1.3 GB
Likes
0
Public
Click a slice to open those files.
.bin438 MB · 100%
From the Hugging Face model README
This model is Part of the NLP assignment for Fatima Fellowship.
This model is a fine-tuned version of 'bert-base-uncased' on the below dataset: Fake News Dataset.
It achieves the following results on the evaluation set:
Fake news: 0
Real news: 1
To use this model, first download it from the hugging face website:
import transformers
from transformers import AutoTokenizer
class Fake_Real_Model_Arch_test(transformers.PreTrainedModel):
def __init__(self,bert):
super(Fake_Real_Model_Arch_test,self).__init__(config=AutoConfig.from_pretrained(MODEL_NAME))
self.bert = bert
num_classes = 2 # number of targets to predict
embedding_dim = 768 # length of embedding dim
self.fc1 = nn.Linear(embedding_dim, num_classes)
self.softmax = nn.Softmax()
def forward(self, text_id, text_mask):
outputs= self.bert(text_id, attention_mask=text_mask)
outputs = outputs[1] # get hidden layers
logit = self.fc1(outputs)
return self.softmax(logit)
tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = Fake_Real_Model_Arch_test(AutoModel.from_pretrained("rematchka/Bert_fake_news_detection"))