READ
Browse fileslabel_map = {"LABEL_0": "negative", "LABEL_1": "positive"}
out = clf("I hated this movie.")[0]
print(label_map[out["label"]], out["score"])
README.md
CHANGED
|
@@ -1,37 +1,62 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
**
|
| 6 |
|
| 7 |
-
**
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
- `
|
| 20 |
-
- `LABEL_1` β `positive`
|
| 21 |
|
| 22 |
---
|
| 23 |
|
| 24 |
-
|
|
|
|
| 25 |
```python
|
| 26 |
from transformers import pipeline
|
| 27 |
|
| 28 |
-
clf = pipeline("text-classification", model="
|
| 29 |
-
|
| 30 |
-
print(clf("I loved this movie!"))
|
| 31 |
-
# [{'label': 'LABEL_1', 'score': 0.998}]
|
| 32 |
|
| 33 |
-
|
| 34 |
-
map = { "LABEL_0": "negative", "LABEL_1": "positive" }
|
| 35 |
-
out = clf("I loved this movie!")[0]
|
| 36 |
-
print(map[out["label"]], out["score"])
|
| 37 |
-
# positive 0.998
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
tags:
|
| 5 |
+
- sentiment-analysis
|
| 6 |
+
- text-classification
|
| 7 |
+
- bert
|
| 8 |
+
- manav
|
| 9 |
+
- ManavDhayeCoder/sentiment-bert
|
| 10 |
+
- ManavDhaye
|
| 11 |
+
pipeline_tag: text-classification
|
| 12 |
+
base_model:
|
| 13 |
+
- google-bert/bert-base-uncased
|
| 14 |
+
datasets:
|
| 15 |
+
- imdb
|
| 16 |
+
library_name: transformers
|
| 17 |
+
widget:
|
| 18 |
+
- text: This movie was amazing!
|
| 19 |
+
- text: Worst movie I have ever seen.
|
| 20 |
+
model-index:
|
| 21 |
+
- name: sentiment-bert
|
| 22 |
+
results: []
|
| 23 |
+
metrics:
|
| 24 |
+
- accuracy
|
| 25 |
+
---
|
| 26 |
|
| 27 |
+
# π BERT Sentiment Analysis Model (Fine-Tuned on IMDB)
|
| 28 |
|
| 29 |
+
This model is a fine-tuned version of **google-bert/bert-base-uncased**, trained on the **IMDB movie reviews dataset** for binary sentiment classification.
|
| 30 |
|
| 31 |
+
It predicts whether text expresses **negative** or **positive** sentiment.
|
| 32 |
+
|
| 33 |
+
This model is hosted by **[@ManavDhayeCoder](https://huggingface.co/ManavDhayeCoder)**.
|
| 34 |
|
| 35 |
---
|
| 36 |
|
| 37 |
+
# π Model Overview
|
| 38 |
+
|
| 39 |
+
| Property | Value |
|
| 40 |
+
|----------|--------|
|
| 41 |
+
| **Base model** | google-bert/bert-base-uncased |
|
| 42 |
+
| **Task** | Sentiment Analysis (Sequence Classification) |
|
| 43 |
+
| **Labels** | negative / positive |
|
| 44 |
+
| **Dataset** | IMDB |
|
| 45 |
+
| **Library** | Hugging Face Transformers |
|
| 46 |
+
| **Format** | model.safetensors |
|
| 47 |
|
| 48 |
+
The model has two classes:
|
| 49 |
+
|
| 50 |
+
- `LABEL_0` β **negative**
|
| 51 |
+
- `LABEL_1` β **positive**
|
|
|
|
| 52 |
|
| 53 |
---
|
| 54 |
|
| 55 |
+
# π₯ Quick Usage Example
|
| 56 |
+
|
| 57 |
```python
|
| 58 |
from transformers import pipeline
|
| 59 |
|
| 60 |
+
clf = pipeline("text-classification", model="ManavDhayeCoder/sentiment-bert")
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
print(clf("This movie was amazing!"))
|
|
|
|
|
|
|
|
|
|
|
|