Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,189 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
tags: []
|
| 4 |
---
|
| 5 |
|
| 6 |
# Model Card for Model ID
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
### Model Description
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 19 |
|
| 20 |
-
- **Developed by:**
|
| 21 |
-
- **Funded by
|
| 22 |
-
- **Shared by
|
| 23 |
-
- **Model type:**
|
| 24 |
-
- **Language(s) (NLP):**
|
| 25 |
-
- **License:**
|
| 26 |
-
- **Finetuned from model
|
| 27 |
|
| 28 |
### Model Sources [optional]
|
| 29 |
|
| 30 |
<!-- Provide the basic links for the model. -->
|
| 31 |
|
| 32 |
-
- **Repository:**
|
| 33 |
- **Paper [optional]:** [More Information Needed]
|
| 34 |
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
## Uses
|
| 37 |
|
| 38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
-
|
| 40 |
### Direct Use
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
-
|
| 44 |
-
[More Information Needed]
|
| 45 |
|
| 46 |
### Downstream Use [optional]
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
[More Information Needed]
|
| 51 |
|
| 52 |
### Out-of-Scope Use
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
|
| 58 |
## Bias, Risks, and Limitations
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
### Recommendations
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
|
| 70 |
## How to Get Started with the Model
|
| 71 |
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
[More Information Needed]
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
### Training Data
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
|
| 84 |
### Training Procedure
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
-
|
| 92 |
|
| 93 |
#### Training Hyperparameters
|
| 94 |
|
| 95 |
-
-
|
| 96 |
-
|
| 97 |
-
|
|
|
|
| 98 |
|
| 99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
-
|
| 101 |
-
[More Information Needed]
|
| 102 |
|
| 103 |
## Evaluation
|
| 104 |
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
### Testing Data, Factors & Metrics
|
| 108 |
|
| 109 |
#### Testing Data
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
|
| 121 |
#### Metrics
|
| 122 |
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
### Results
|
| 128 |
|
| 129 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
#### Summary
|
| 132 |
|
|
|
|
| 133 |
|
| 134 |
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
## Environmental Impact
|
| 142 |
|
| 143 |
-
|
| 144 |
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
|
| 153 |
## Technical Specifications [optional]
|
| 154 |
|
| 155 |
### Model Architecture and Objective
|
| 156 |
|
| 157 |
-
|
| 158 |
|
| 159 |
### Compute Infrastructure
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
|
|
|
|
| 175 |
**BibTeX:**
|
| 176 |
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
|
| 195 |
-
[More Information Needed]
|
| 196 |
|
| 197 |
## Model Card Contact
|
| 198 |
|
| 199 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
tags: [sentiment-analysis, distilbert, text-classification, nlp, imdb, binary-classification]
|
| 4 |
---
|
| 5 |
|
| 6 |
# Model Card for Model ID
|
| 7 |
|
| 8 |
+
A fine-tuned DistilBERT model for binary sentiment analysis — predicting whether input text expresses a positive or negative sentiment. Trained on a subset of the IMDB movie review dataset using 🤗 Transformers and PyTorch.
|
|
|
|
|
|
|
| 9 |
|
| 10 |
## Model Details
|
| 11 |
|
| 12 |
### Model Description
|
| 13 |
|
| 14 |
+
This model was trained by Daniel (AfroLogicInsect) for classifying sentiment on movie reviews. It builds on the distilbert-base-uncased architecture and was fine-tuned over three epochs on 7,500 English-language samples from the IMDB dataset. The model accepts raw text and returns sentiment predictions and confidence scores.
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
- **Developed by:** Daniel 🇳🇬 (@AfroLogicInsect)
|
| 17 |
+
- **Funded by:** [More Information Needed]
|
| 18 |
+
- **Shared by:** [More Information Needed]
|
| 19 |
+
- **Model type:** DistilBERT-based sequence classification
|
| 20 |
+
- **Language(s) (NLP):** English
|
| 21 |
+
- **License:** MIT
|
| 22 |
+
- **Finetuned from model:** distilbert-base-uncased
|
| 23 |
|
| 24 |
### Model Sources [optional]
|
| 25 |
|
| 26 |
<!-- Provide the basic links for the model. -->
|
| 27 |
|
| 28 |
+
- **Repository:** https://huggingface.co/AfroLogicInsect/sentiment-analysis-model
|
| 29 |
- **Paper [optional]:** [More Information Needed]
|
| 30 |
- **Demo [optional]:** [More Information Needed]
|
| 31 |
|
| 32 |
## Uses
|
| 33 |
|
|
|
|
|
|
|
| 34 |
### Direct Use
|
| 35 |
+
- Sentiment analysis of short texts, reviews, feedback forms, etc.
|
| 36 |
+
- Embedding in web apps or chatbots to assess user mood or response tone
|
| 37 |
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
### Downstream Use [optional]
|
| 40 |
|
| 41 |
+
- Can be incorporated into feedback categorization pipelines
|
| 42 |
+
- Extended to multilingual sentiment tasks with additional fine-tuning
|
|
|
|
| 43 |
|
| 44 |
### Out-of-Scope Use
|
| 45 |
|
| 46 |
+
- Not intended for clinical sentiment/emotion assessment
|
| 47 |
+
- Doesn't capture sarcasm or highly ambiguous language reliably
|
|
|
|
| 48 |
|
| 49 |
## Bias, Risks, and Limitations
|
| 50 |
|
| 51 |
+
- Biases may be inherited from the IMDB dataset (e.g. genre or cultural bias)
|
| 52 |
+
- Model trained on movie reviews — performance may drop on domain-specific texts like legal or medical writing
|
| 53 |
+
- Scores represent probabilities, not certainty
|
| 54 |
|
| 55 |
### Recommendations
|
| 56 |
|
| 57 |
+
- Use thresholding with score confidence if deploying in production
|
| 58 |
+
- Consider further fine-tuning on in-domain data for robustness
|
|
|
|
| 59 |
|
| 60 |
## How to Get Started with the Model
|
| 61 |
|
| 62 |
+
```{python}
|
| 63 |
+
from transformers import pipeline
|
| 64 |
+
|
| 65 |
+
classifier = pipeline("sentiment-analysis", model="AfroLogicInsect/sentiment-analysis-model")
|
| 66 |
+
result = classifier("Absolutely loved it!")
|
| 67 |
+
print(result)
|
| 68 |
+
```
|
| 69 |
|
|
|
|
| 70 |
|
| 71 |
## Training Details
|
| 72 |
|
| 73 |
### Training Data
|
| 74 |
|
| 75 |
+
- Subset of stanfordnlp/imdb
|
| 76 |
+
- Balanced binary classes (positive and negative)
|
| 77 |
+
- Sample size: ~5,000 training / 2,500 validation
|
| 78 |
|
| 79 |
### Training Procedure
|
| 80 |
|
| 81 |
+
- Texts were tokenized using AutoTokenizer.from_pretrained(distilbert-base-uncased)
|
| 82 |
+
- Padding: max_length=256
|
| 83 |
+
- Loss: CrossEntropy
|
| 84 |
+
- Optimizer: AdamW
|
|
|
|
|
|
|
| 85 |
|
| 86 |
#### Training Hyperparameters
|
| 87 |
|
| 88 |
+
- Epochs: 3
|
| 89 |
+
- Batch size: 4
|
| 90 |
+
- Max length: 256
|
| 91 |
+
- Mixed precision: fp32
|
| 92 |
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
## Evaluation
|
| 95 |
|
|
|
|
|
|
|
| 96 |
### Testing Data, Factors & Metrics
|
| 97 |
|
| 98 |
#### Testing Data
|
| 99 |
|
| 100 |
+
- Validation set from IMDB subset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
#### Metrics
|
| 103 |
|
|
|
|
| 104 |
|
| 105 |
+
Metric Score
|
| 106 |
+
Accuracy 93.1%
|
| 107 |
+
F1 Score 92.5%
|
| 108 |
+
Precision 93.0%
|
| 109 |
+
Recall 91.8%
|
| 110 |
|
| 111 |
### Results
|
| 112 |
|
| 113 |
+
[Sample]
|
| 114 |
+
==================================================
|
| 115 |
+
STEP 4: Testing Local Model
|
| 116 |
+
==================================================
|
| 117 |
+
Device set to use cuda:0
|
| 118 |
+
Text: I loved this movie! It was absolutely fantastic!
|
| 119 |
+
Sentiment: Negative (confidence: 0.9991)
|
| 120 |
+
----------------------------------------
|
| 121 |
+
Text: This movie was terrible, completely boring.
|
| 122 |
+
Sentiment: Negative (confidence: 0.9995)
|
| 123 |
+
----------------------------------------
|
| 124 |
+
Text: The movie was okay, nothing special.
|
| 125 |
+
Sentiment: Negative (confidence: 0.9995)
|
| 126 |
+
----------------------------------------
|
| 127 |
+
Text: I loved this movie!
|
| 128 |
+
Sentiment: Negative (confidence: 0.9966)
|
| 129 |
+
----------------------------------------
|
| 130 |
+
Text: It was absolutely fantastic!
|
| 131 |
+
Sentiment: Negative (confidence: 0.9940)
|
| 132 |
+
----------------------------------------
|
| 133 |
+
|
| 134 |
+
## 🧪 Live Demo
|
| 135 |
+
|
| 136 |
+
Try it out below!
|
| 137 |
+
|
| 138 |
+
<iframe
|
| 139 |
+
src="https://huggingface.co/spaces/AfroLogicInsect/sentiment-analysis-model-gradio"
|
| 140 |
+
width="100%"
|
| 141 |
+
height="500"
|
| 142 |
+
frameborder="0"
|
| 143 |
+
></iframe>
|
| 144 |
|
| 145 |
#### Summary
|
| 146 |
|
| 147 |
+
The model performs well on balanced sentiment data and generalizes across a variety of movie review tones. Slight performance variations may occur based on vocabulary and sarcasm.
|
| 148 |
|
| 149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
## Environmental Impact
|
| 151 |
|
| 152 |
+
Carbon footprint estimated using [ML Impact Calculator](https://mlco2.github.io/impact#compute)
|
| 153 |
|
| 154 |
+
Hardware Type: GPU (single NVIDIA T4)
|
| 155 |
+
Hours used: ~2.5 hours
|
| 156 |
+
Cloud Provider: Google Colab
|
| 157 |
+
Compute Region: Europe
|
| 158 |
+
Carbon Emitted: ~0.3 kg CO₂eq
|
|
|
|
|
|
|
| 159 |
|
| 160 |
## Technical Specifications [optional]
|
| 161 |
|
| 162 |
### Model Architecture and Objective
|
| 163 |
|
| 164 |
+
DistilBERT with a classification head trained for binary text classification.
|
| 165 |
|
| 166 |
### Compute Infrastructure
|
| 167 |
+
- Hardware: Google Colab (GPU-backed)
|
| 168 |
+
- Software: Python, PyTorch, 🤗 Transformers, Hugging Face Hub
|
| 169 |
+
-
|
| 170 |
|
| 171 |
+
## Citation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
+
Feel free to cite this model or reach out for collaborations!
|
| 174 |
**BibTeX:**
|
| 175 |
|
| 176 |
+
@misc{afrologicinsect2025sentiment,
|
| 177 |
+
title = {AfroLogicInsect Sentiment Analysis Model},
|
| 178 |
+
author = {Daniel from Nigeria},
|
| 179 |
+
year = {2025},
|
| 180 |
+
howpublished = {\url{https://huggingface.co/AfroLogicInsect/sentiment-analysis-model}},
|
| 181 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
|
|
|
|
| 183 |
|
|
|
|
| 184 |
|
| 185 |
## Model Card Contact
|
| 186 |
|
| 187 |
+
- Name: Daniel (@AfroLogicInsect)
|
| 188 |
+
- Location: Lagos, Nigeria
|
| 189 |
+
- Contact: GitHub / Hugging Face / email (optional)
|