Add README.md with model description
Browse files
README.md
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 🧠 Sentiment Analysis Model — DistilBERT Fine-Tuned on IMDb 🎬
|
2 |
+
|
3 |
+
This model is a fine-tuned version of [`distilbert-base-uncased`](https://huggingface.co/distilbert-base-uncased) on the [IMDb movie review dataset](https://huggingface.co/datasets/imdb) for **binary sentiment classification** (positive/negative). It was trained using Hugging Face Transformers and PyTorch.
|
4 |
+
|
5 |
+
## 🔍 Intended Use
|
6 |
+
|
7 |
+
This model is designed to classify movie reviews (or other English text) as **positive** or **negative** sentiment. It's ideal for:
|
8 |
+
- Opinion mining
|
9 |
+
- Social media analysis
|
10 |
+
- Review classification
|
11 |
+
- Text classification demos
|
12 |
+
|
13 |
+
## 🧪 Example Usage
|
14 |
+
|
15 |
+
```python
|
16 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
17 |
+
import torch
|
18 |
+
|
19 |
+
model_name = "bmdavis/my-language-model"
|
20 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
21 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
22 |
+
|
23 |
+
text = "This movie was amazing and really well-acted!"
|
24 |
+
inputs = tokenizer(text, return_tensors="pt")
|
25 |
+
outputs = model(**inputs)
|
26 |
+
prediction = torch.argmax(outputs.logits).item()
|
27 |
+
|
28 |
+
print("Sentiment:", "Positive" if prediction == 1 else "Negative")
|