Downloads · 30 days
15
20% of all-time downloads
Rahilgh/mbert-algerian-darija-misinformation-detection
mbert-algerian-darija-misinformation-detection is a text classification model from Rahilgh. Use it when you need a label for a piece of text. The card lists the license as mit.
Fine-tuned BERT-base-multilingual-cased for detecting misinformation in Algerian Darija text.
Downloads · 30 days
15
20% of all-time downloads
All-time downloads
76
Public
Parameters
178M
2.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.pt2.1 GB · 75%
From the Hugging Face model README
Fine-tuned BERT-base-multilingual-cased for detecting misinformation in Algerian Darija text.
bert-base-multilingual-cased (170M parameters)Per-class F1:
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
MODEL_ID = "Rahilgh/model4_1"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device).eval()
LABEL_MAP = {0: "F", 1: "R", 2: "N", 3: "M", 4: "S"}
LABEL_NAMES = {
"F": "Factual",
"R": "Reporting",
"N": "Non-factual",
"M": "Misleading",
"S": "Satire"
}
texts = [
"قالك بلي رايحين ينحو الباك هذا العام",
]
for text in texts:
inputs = tokenizer(
text,
return_tensors="pt",
max_length=128,
truncation=True,
padding=True,
).to(device)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)[0]
pred_id = probs.argmax().item()
confidence = probs[pred_id].item()
label = LABEL_MAP[pred_id]
print(f"Text: {text}")
print(f"Prediction: {LABEL_NAMES[label]} ({label}) — {confidence:.2%}\n")