Views
No views yet
1e-516 (with gradient accumulation = 32)0.015e-632256 tokens0.11from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3model = AutoModelForSequenceClassification.from_pretrained("monsifnadir/DarijaBERT-For-Sentiment-Analysis")
4tokenizer = AutoTokenizer.from_pretrained("monsifnadir/DarijaBERT-For-Sentiment-Analysis")
5
6text = "فرحت بزاف اليوم الحمد لله"
7inputs = tokenizer(text, return_tensors="pt", truncation=True)
8outputs = model(**inputs)
9predicted_class = outputs.logits.argmax(dim=-1).item()
10
11# Map prediction to label
12label_map = {0: "Neutral", 1: "Negative", 2: "Positive"}
13print("Predicted Sentiment:", label_map[predicted_class])