Update README.md
Browse files
README.md
CHANGED
|
@@ -1,69 +1,81 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
| 3 |
license: apache-2.0
|
| 4 |
-
base_model: bert-base-multilingual-cased
|
| 5 |
tags:
|
| 6 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
metrics:
|
| 8 |
- accuracy
|
| 9 |
- f1
|
| 10 |
model-index:
|
| 11 |
- name: urdu-sentiment-classifier
|
| 12 |
-
results:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
-
|
| 16 |
-
should probably proofread and complete it, then remove this comment. -->
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
-
It achieves the following results on the evaluation set:
|
| 22 |
-
- Loss: 1.0358
|
| 23 |
-
- Accuracy: 0.8074
|
| 24 |
-
- F1: 0.8073
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
|
|
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
| 43 |
-
- learning_rate: 2e-05
|
| 44 |
-
- train_batch_size: 64
|
| 45 |
-
- eval_batch_size: 128
|
| 46 |
-
- seed: 42
|
| 47 |
-
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 48 |
-
- lr_scheduler_type: linear
|
| 49 |
-
- lr_scheduler_warmup_steps: 100
|
| 50 |
-
- num_epochs: 5
|
| 51 |
-
- mixed_precision_training: Native AMP
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|:-------------:|:-----:|:----:|:---------------:|:--------:|:------:|
|
| 57 |
-
| 0.8904 | 1.0 | 625 | 0.9830 | 0.7664 | 0.7622 |
|
| 58 |
-
| 0.7935 | 2.0 | 1250 | 0.8413 | 0.7978 | 0.7975 |
|
| 59 |
-
| 0.6253 | 3.0 | 1875 | 0.9115 | 0.8021 | 0.8014 |
|
| 60 |
-
| 0.5877 | 4.0 | 2500 | 0.9304 | 0.8055 | 0.8051 |
|
| 61 |
-
| 0.4309 | 5.0 | 3125 | 1.0358 | 0.8074 | 0.8073 |
|
| 62 |
|
|
|
|
| 63 |
|
| 64 |
-
##
|
| 65 |
|
| 66 |
-
-
|
| 67 |
-
-
|
| 68 |
-
-
|
| 69 |
-
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- ur
|
| 4 |
license: apache-2.0
|
|
|
|
| 5 |
tags:
|
| 6 |
+
- text-classification
|
| 7 |
+
- sentiment-analysis
|
| 8 |
+
- urdu
|
| 9 |
+
- bert
|
| 10 |
+
- fine-tuned
|
| 11 |
+
- nlp
|
| 12 |
+
datasets:
|
| 13 |
+
- mirfan899/imdb_urdu_reviews
|
| 14 |
metrics:
|
| 15 |
- accuracy
|
| 16 |
- f1
|
| 17 |
model-index:
|
| 18 |
- name: urdu-sentiment-classifier
|
| 19 |
+
results:
|
| 20 |
+
- task:
|
| 21 |
+
type: text-classification
|
| 22 |
+
dataset:
|
| 23 |
+
name: IMDB Urdu Reviews
|
| 24 |
+
type: mirfan899/imdb_urdu_reviews
|
| 25 |
+
metrics:
|
| 26 |
+
- type: accuracy
|
| 27 |
+
value: 0.81
|
| 28 |
+
- type: f1
|
| 29 |
+
value: 0.8098
|
| 30 |
---
|
| 31 |
|
| 32 |
+
# Urdu Sentiment Classifier 🇵🇰
|
|
|
|
| 33 |
|
| 34 |
+
A fine-tuned **bert-base-multilingual-cased** model for **Urdu sentiment analysis** — classifying Urdu text as positive or negative.
|
| 35 |
|
| 36 |
+
## Live Demo
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
[Try it on HuggingFace Spaces](https://huggingface.co/spaces/H-Layba/urdu-sentiment-classifier)
|
| 39 |
|
| 40 |
+
## Performance
|
| 41 |
|
| 42 |
+
| Metric | Score |
|
| 43 |
+
|--------|-------|
|
| 44 |
+
| Accuracy | 81.00% |
|
| 45 |
+
| F1 Score (weighted) | 0.8098 |
|
| 46 |
|
| 47 |
+
## Example Predictions
|
| 48 |
|
| 49 |
+
```python
|
| 50 |
+
from transformers import pipeline
|
| 51 |
|
| 52 |
+
classifier = pipeline("text-classification", model="H-Layba/urdu-sentiment-classifier")
|
| 53 |
|
| 54 |
+
classifier("یہ فلم بہت اچھی تھی")
|
| 55 |
+
# [{'label': 'positive', 'score': 0.9936}]
|
| 56 |
|
| 57 |
+
classifier("آج کا دن بہت برا تھا")
|
| 58 |
+
# [{'label': 'negative', 'score': 0.9918}]
|
| 59 |
+
```
|
| 60 |
|
| 61 |
+
## Training Details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
- **Base model:** bert-base-multilingual-cased
|
| 64 |
+
- **Dataset:** 50,000 Urdu movie reviews
|
| 65 |
+
- **Epochs:** 5
|
| 66 |
+
- **Learning rate:** 2e-5
|
| 67 |
+
- **Batch size:** 32 (train), 64 (eval)
|
| 68 |
+
- **Hardware:** Kaggle T4 GPU
|
| 69 |
+
- **Mixed precision:** fp16
|
| 70 |
|
| 71 |
+
## Dataset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
Trained on `mirfan899/imdb_urdu_reviews` — 50,000 Urdu translations of IMDB movie reviews with positive/negative sentiment labels.
|
| 74 |
|
| 75 |
+
## Part of Urdu NLP Suite
|
| 76 |
|
| 77 |
+
This model is part of a larger collection of fine-tuned Urdu NLP models:
|
| 78 |
+
- [x] Sentiment Classification ← this model
|
| 79 |
+
- [ ] Text Summarization
|
| 80 |
+
- [ ] Question Answering
|
| 81 |
+
- [ ] Urdu → English Translation
|