Downloads · 30 days
9
2% of all-time downloads
monsifnadir/DarijaBERT-For-Sentiment-Analysis
DarijaBERT-For-Sentiment-Analysis is a text classification model from monsifnadir. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
This sentiment analysis model is based on DarijaBERT, a language model pretrained on Moroccan Arabic (Darija) text. The model has been fine-tuned to classify Moroccan Arabic tweets and public comments into three senti…
Downloads · 30 days
9
2% of all-time downloads
All-time downloads
376
Public
Parameters
147M
590 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors590 MB · 99%
From the Hugging Face model README
This sentiment analysis model is based on DarijaBERT, a language model pretrained on Moroccan Arabic (Darija) text.
The model has been fine-tuned to classify Moroccan Arabic tweets and public comments into three sentiment categories:
The base DarijaBERT architecture was extended with:
1e-516 (with gradient accumulation = 32)0.01Performance:
5e-632256 tokens0.1Performance:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
model = AutoModelForSequenceClassification.from_pretrained("monsifnadir/DarijaBERT-For-Sentiment-Analysis")
tokenizer = AutoTokenizer.from_pretrained("monsifnadir/DarijaBERT-For-Sentiment-Analysis")
text = "فرحت بزاف اليوم الحمد لله"
inputs = tokenizer(text, return_tensors="pt", truncation=True)
outputs = model(**inputs)
predicted_class = outputs.logits.argmax(dim=-1).item()
# Map prediction to label
label_map = {0: "Neutral", 1: "Negative", 2: "Positive"}
print("Predicted Sentiment:", label_map[predicted_class])