Instructions to use Sudheer17/Sentiment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sudheer17/Sentiment with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Sudheer17/Sentiment")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Sudheer17/Sentiment", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-classification
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Sentiment Analysis Models
|
| 8 |
+
|
| 9 |
+
This repository contains multiple trained sentiment analysis models for binary sentiment classification (Positive / Negative).
|
| 10 |
+
|
| 11 |
+
## Repository Structure
|
| 12 |
+
|
| 13 |
+
```
|
| 14 |
+
Sentiment/
|
| 15 |
+
β
|
| 16 |
+
βββ BERT/
|
| 17 |
+
βββ Bi_LSTM/
|
| 18 |
+
βββ Linear_Svm/
|
| 19 |
+
βββ Logistic_Regression/
|
| 20 |
+
βββ Lstm/
|
| 21 |
+
βββ Naive Bayes/
|
| 22 |
+
βββ XGBoost/
|
| 23 |
+
βββ Notebooks/
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
# Available Models
|
| 29 |
+
|
| 30 |
+
- BERT
|
| 31 |
+
- LSTM
|
| 32 |
+
- Bi-LSTM
|
| 33 |
+
- Logistic Regression
|
| 34 |
+
- Linear SVM
|
| 35 |
+
- Naive Bayes
|
| 36 |
+
- XGBoost
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
# Using the BERT Model
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
from transformers import pipeline
|
| 44 |
+
|
| 45 |
+
classifier = pipeline(
|
| 46 |
+
"text-classification",
|
| 47 |
+
model="Sudheer17/Sentiment/BERT"
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
result = classifier("I love this movie!")
|
| 51 |
+
|
| 52 |
+
print(result)
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
Example Output
|
| 56 |
+
|
| 57 |
+
```python
|
| 58 |
+
[{'label': 'Positive', 'score': 0.9848}]
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
---
|
| 62 |
+
|
| 63 |
+
# Example Inputs
|
| 64 |
+
|
| 65 |
+
```text
|
| 66 |
+
I love this movie!
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
```text
|
| 70 |
+
This is the worst experience ever.
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
```text
|
| 74 |
+
The service was average.
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
---
|
| 78 |
+
|
| 79 |
+
# Notes
|
| 80 |
+
|
| 81 |
+
- The BERT model can be loaded directly using the Hugging Face Transformers library.
|
| 82 |
+
- Classical Machine Learning and Deep Learning models are stored in their respective folders.
|
| 83 |
+
- Use the appropriate tokenizer and preprocessing pipeline when working with non-BERT models.
|
| 84 |
+
|
| 85 |
+
---
|
| 86 |
+
|
| 87 |
+
# Requirements
|
| 88 |
+
|
| 89 |
+
```
|
| 90 |
+
transformers
|
| 91 |
+
torch
|
| 92 |
+
tensorflow
|
| 93 |
+
scikit-learn
|
| 94 |
+
joblib
|
| 95 |
+
numpy
|
| 96 |
+
pandas
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
Install them using:
|
| 100 |
+
|
| 101 |
+
```bash
|
| 102 |
+
pip install transformers torch tensorflow scikit-learn joblib numpy pandas
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
# License
|
| 108 |
+
|
| 109 |
+
This repository is released under the MIT License.
|