Update README.md
Browse files
README.md
CHANGED
|
@@ -14,4 +14,44 @@ tags:
|
|
| 14 |
|
| 15 |
---
|
| 16 |
|
| 17 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
---
|
| 16 |
|
| 17 |
+
#
|
| 18 |
+
|
| 19 |
+
# ๐ฆ TinyBERT IMDB Sentiment Analysis Model
|
| 20 |
+
|
| 21 |
+
This is a fine-tuned [TinyBERT](https://huggingface.co/huawei-noah/TinyBERT_General_4L_312D) model for binary **sentiment classification** on a 5,000-sample subset of the [IMDB dataset](https://huggingface.co/datasets/imdb).
|
| 22 |
+
It predicts whether a movie review is **positive** or **negative**.
|
| 23 |
+
|
| 24 |
+
## ๐ง Model Details
|
| 25 |
+
|
| 26 |
+
- **Base model:** [`huawei-noah/TinyBERT_General_4L_312D`](https://huggingface.co/huawei-noah/TinyBERT_General_4L_312D)
|
| 27 |
+
- **Task:** Sentiment Classification (Binary)
|
| 28 |
+
- **Dataset:** 4,000 training + 1,000 test samples from IMDB
|
| 29 |
+
- **Tokenizer:** `AutoTokenizer.from_pretrained('huawei-noah/TinyBERT_General_4L_312D')`
|
| 30 |
+
- **Max length:** 300 tokens
|
| 31 |
+
- **Batch size:** 64
|
| 32 |
+
- **Training framework:** Hugging Face `Trainer`
|
| 33 |
+
- **Device:** A100 GPU
|
| 34 |
+
|
| 35 |
+
## ๐ Evaluation Metrics
|
| 36 |
+
## ๐ Evaluation Metrics (on 1,000-sample test set)
|
| 37 |
+
|
| 38 |
+
| Metric | Value |
|
| 39 |
+
|-----------------------|----------|
|
| 40 |
+
| Accuracy | **88.02%** |
|
| 41 |
+
| Evaluation Loss | 0.2962 |
|
| 42 |
+
| Runtime | 30.9 sec |
|
| 43 |
+
| Samples per Second | 485 |
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
## ๐ How to Use
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from transformers import pipeline
|
| 50 |
+
|
| 51 |
+
classifier = pipeline(
|
| 52 |
+
"text-classification",
|
| 53 |
+
model="Harsha901/tinybert-imdb-sentiment-analysis-model"
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
result = classifier("This movie was absolutely amazing!")
|
| 57 |
+
print(result) # [{'label': 'LABEL_1', 'score': 0.98}]
|