Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- sentiment-analysis
|
| 5 |
+
- flan-t5
|
| 6 |
+
- text-classification
|
| 7 |
+
license: apache-2.0
|
| 8 |
+
datasets:
|
| 9 |
+
- imdb
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# FLAN-T5 Small - Sentiment Analysis
|
| 13 |
+
|
| 14 |
+
Fine-tuned version of `google/flan-t5-small` for sentiment analysis on IMDB reviews.
|
| 15 |
+
|
| 16 |
+
## Model Details
|
| 17 |
+
- **Base Model:** google/flan-t5-small
|
| 18 |
+
- **Task:** Binary sentiment classification (positive/negative)
|
| 19 |
+
- **Dataset:** IMDB movie reviews (300 training samples)
|
| 20 |
+
- **Accuracy:** 85.00%
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
```python
|
| 25 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 26 |
+
|
| 27 |
+
tokenizer = AutoTokenizer.from_pretrained("usef310/flan-t5-small-sentiment")
|
| 28 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("usef310/flan-t5-small-sentiment")
|
| 29 |
+
|
| 30 |
+
text = "This movie was amazing!"
|
| 31 |
+
inputs = tokenizer("sentiment: " + text, return_tensors="pt")
|
| 32 |
+
outputs = model.generate(**inputs)
|
| 33 |
+
prediction = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 34 |
+
print(prediction) # Output: positive or negative
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Training Details
|
| 38 |
+
- Epochs: 3
|
| 39 |
+
- Batch size: 4 (with gradient accumulation)
|
| 40 |
+
- Learning rate: 5e-5
|
| 41 |
+
- Optimizer: AdamW
|