Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3# Load the tokenizer and model
4tokenizer = AutoTokenizer.from_pretrained("BenhamdaneNawfal/sentiment-analysis-darija")
5model = AutoModelForSequenceClassification.from_pretrained("BenhamdaneNawfal/sentiment-analysis-darija")
6
7# Example text
8test_text = "هذا المنتج رائع جدا"
9
10# Tokenize the text
11inputs = tokenizer(test_text, return_tensors="pt", truncation=True, padding=True, max_length=128)
12
13# Get model predictions
14outputs = model(**inputs)
15logits = outputs.logits
16predicted_class = logits.argmax().item()
17
18print(f"Predicted class: {predicted_class}")huggingface_hub library. To reproduce or fine-tune this model, follow these steps:1model.save_pretrained("darija-bert-model")
2tokenizer.save_pretrained("darija-bert-model")@misc{benhamdanenawfal2025darijabert,
author = {Benhamdane Nawfal},
title = {Sentiment Analysis for Darija (Arabic Dialect)},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/BenhamdaneNawfal/sentiment-analysis-darija}
}