Downloads · 30 days
5
17% of all-time downloads
Bahar-82/parsbert-persian-absa
parsbert-persian-absa is a text classification model from Bahar-82. Use it when you need a label for a piece of text. The card lists the license as mit.
Fine-tuned for aspect-category sentiment classification (ACSC) on Persian product reviews across four categories: laptops, mobile phones, tablets and smartwatches.
Downloads · 30 days
5
17% of all-time downloads
All-time downloads
29
Public
Parameters
163M
651 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors651 MB · 100%
From the Hugging Face model README
Fine-tuned for aspect-category sentiment classification (ACSC) on Persian product reviews across four categories: laptops, mobile phones, tablets and smartwatches.
The model takes an (aspect, text) pair, not text alone:
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tok = AutoTokenizer.from_pretrained("Bahar-82/parsbert-persian-absa")
mdl = AutoModelForSequenceClassification.from_pretrained(
"Bahar-82/parsbert-persian-absa").eval()
text = "صفحه نمایش خوبه ولی باتری ضعیفه"
aspect = "باتری و شارژ"
enc = tok(aspect, text, truncation=True, padding="max_length",
max_length=96, return_tensors="pt")
with torch.no_grad():
pred = mdl(**enc).logits.argmax(-1).item()
print(mdl.config.id2label[pred]) # Negative
Passing the full review text matters: feeding a truncated clause instead drops accuracy noticeably, because the model was trained on complete reviews.
Evaluated with 5-fold StratifiedGroupKFold (grouped by review text, so no
review appears in both train and test) on 1038 samples:
| Metric | Value |
|---|---|
| Accuracy | 89.3% ± 3.1% |
| F1-macro | 0.892 |
| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| Negative | 0.873 | 0.889 | 0.881 | 316 |
| Neutral | 0.930 | 0.890 | 0.910 | 328 |
| Positive | 0.878 | 0.896 | 0.887 | 394 |
4 epochs, lr 2e-5, batch size 8, max_length 96, weight_decay 0.01, warmup_ratio 0.1, seed 42.
Trained on 1038 single-annotator samples without inter-annotator agreement. The base model was already sentiment-tuned on Digikala data, so overlap with the evaluation set cannot be fully ruled out.