Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,138 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
# Model Card for Model
|
| 7 |
-
|
| 8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 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:** [More Information Needed]
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
- **Repository:** [
|
| 33 |
-
- **Paper
|
| 34 |
-
- **Demo
|
| 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 |
-
|
| 43 |
-
|
| 44 |
-
[More Information Needed]
|
| 45 |
-
|
| 46 |
-
### Downstream Use [optional]
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
|
|
|
| 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 |
-
|
| 69 |
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
-
###
|
| 79 |
-
|
| 80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
-
|
| 84 |
-
### Training Procedure
|
| 85 |
-
|
| 86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
-
|
| 88 |
-
#### Preprocessing [optional]
|
| 89 |
|
| 90 |
-
|
|
|
|
| 91 |
|
|
|
|
| 92 |
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 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 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
|
| 131 |
-
|
| 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 |
-
Carbon
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 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 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 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 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 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 |
-
##
|
| 194 |
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
-
##
|
| 198 |
|
| 199 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
tags:
|
| 4 |
+
- topic
|
| 5 |
+
- multi-sentiment
|
| 6 |
+
license: mit
|
| 7 |
+
datasets:
|
| 8 |
+
- valurank/Topic_Classification
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
metrics:
|
| 12 |
+
- accuracy
|
| 13 |
+
- f1
|
| 14 |
+
- precision
|
| 15 |
+
- recall
|
| 16 |
+
base_model:
|
| 17 |
+
- distilbert/distilbert-base-uncased
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# Model Card for Topic Classification Model
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
A fine-tuned DistilBERT model for multi-class topic classification. This model predicts the most relevant topic label from a predefined set based on input text. It was trained using 🤗 Transformers and PyTorch on a custom dataset derived from academic and news-style corpora.
|
| 23 |
|
| 24 |
## Model Details
|
| 25 |
|
| 26 |
### Model Description
|
| 27 |
|
| 28 |
+
This model was developed by Daniel (@AfroLogicInsect) to classify text into one of several predefined topics. It builds on the `distilbert-base-uncased` architecture and was fine-tuned for multi-class classification using a softmax output layer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
- **Developed by:** Daniel 🇳🇬 (@AfroLogicInsect)
|
| 31 |
+
- **Model type:** DistilBERT-based multi-class sequence classifier
|
| 32 |
+
- **Language(s):** English
|
| 33 |
+
- **License:** MIT
|
| 34 |
+
- **Finetuned from:** distilbert-base-uncased
|
| 35 |
|
| 36 |
+
### Model Sources
|
| 37 |
|
| 38 |
+
- **Repository:** [AfroLogicInsect/topic-model-analysis-model](https://huggingface.co/AfroLogicInsect/topic-model-analysis-model)
|
| 39 |
+
- **Paper:** arXiv:1910.09700 (DistilBERT)
|
| 40 |
+
- **Demo:** [Coming soon]
|
| 41 |
|
| 42 |
## Uses
|
| 43 |
|
|
|
|
|
|
|
| 44 |
### Direct Use
|
| 45 |
|
| 46 |
+
- Classify academic or news-style text into topics such as AI, finance, sports, climate, etc.
|
| 47 |
+
- Embed in dashboards or content moderation tools for automatic tagging
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
### Downstream Use
|
| 50 |
|
| 51 |
+
- Can be extended to hierarchical topic classification
|
| 52 |
+
- Useful for building recommendation engines or content filters
|
| 53 |
|
| 54 |
### Out-of-Scope Use
|
| 55 |
|
| 56 |
+
- Not suitable for sentiment or emotion classification
|
| 57 |
+
- May not generalize well to informal or slang-heavy text
|
|
|
|
| 58 |
|
| 59 |
## Bias, Risks, and Limitations
|
| 60 |
|
| 61 |
+
- Trained on curated corpora — may reflect biases in source material
|
| 62 |
+
- Topics are predefined and static — emerging topics may be misclassified
|
| 63 |
+
- Confidence scores are probabilistic, not definitive
|
| 64 |
|
| 65 |
### Recommendations
|
| 66 |
|
| 67 |
+
- Use `top_k=5` with `return_all_scores=True` to retrieve multiple topic predictions
|
| 68 |
+
- Consider fine-tuning on domain-specific data for improved accuracy
|
| 69 |
|
| 70 |
+
## How to Get Started
|
| 71 |
|
| 72 |
+
```python
|
| 73 |
+
from transformers import pipeline
|
| 74 |
|
| 75 |
+
classifier = pipeline(
|
| 76 |
+
"text-classification",
|
| 77 |
+
model="AfroLogicInsect/topic-model-analysis-model",
|
| 78 |
+
tokenizer="AfroLogicInsect/topic-model-analysis-model",
|
| 79 |
+
return_all_scores=True
|
| 80 |
+
)
|
| 81 |
|
| 82 |
+
text = "New AI breakthrough in natural language processing"
|
| 83 |
+
results = classifier(text)
|
| 84 |
+
top_5 = sorted(results[0], key=lambda x: x['score'], reverse=True)[:5]
|
| 85 |
+
for i, res in enumerate(top_5):
|
| 86 |
+
print(f"Top {i+1}: {res['label']} ({res['score']:.3f})")
|
| 87 |
+
```
|
| 88 |
|
| 89 |
## Training Details
|
| 90 |
|
| 91 |
+
### Dataset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
+
- Custom multi-class topic dataset based on arXiv abstracts and news articles
|
| 94 |
+
- Labels include domains like AI, finance, sports, climate, etc.
|
| 95 |
|
| 96 |
+
### Hyperparameters
|
| 97 |
|
| 98 |
+
- Epochs: 3
|
| 99 |
+
- Batch size: 16
|
| 100 |
+
- Learning rate: 2e-5
|
| 101 |
+
- Evaluation every 200 steps
|
| 102 |
+
- Metric: F1 score
|
| 103 |
|
| 104 |
+
### Trainer Setup
|
| 105 |
|
| 106 |
+
Used Hugging Face `Trainer` API with `TrainingArguments` configured for early stopping and best model selection.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
## Evaluation
|
| 109 |
|
| 110 |
+
Model achieved strong performance across multiple topic categories. Evaluation metrics include:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
+
- **Accuracy:** ~90.8%
|
| 113 |
+
- **F1 Score:** ~0.91
|
| 114 |
+
- **Precision:** ~0.89
|
| 115 |
+
- **Recall:** ~0.93
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
## Environmental Impact
|
| 118 |
|
| 119 |
+
- **Hardware:** Google Colab (NVIDIA T4 GPU)
|
| 120 |
+
- **Training Time:** ~2.5 hours
|
| 121 |
+
- **Carbon Emitted:** ~0.3 kg CO₂eq (estimated via [ML Impact Calculator](https://mlco2.github.io/impact#compute))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
+
## Citation
|
| 124 |
|
| 125 |
+
```bibtex
|
| 126 |
+
@misc{afrologicinsect2025topicmodel,
|
| 127 |
+
title = {AfroLogicInsect Topic Classification Model},
|
| 128 |
+
author = {Akan Daniel},
|
| 129 |
+
year = {2025},
|
| 130 |
+
howpublished = {\url{https://huggingface.co/AfroLogicInsect/topic-model-analysis-model}},
|
| 131 |
+
}
|
| 132 |
+
```
|
| 133 |
|
| 134 |
+
## Contact
|
| 135 |
|
| 136 |
+
- Name: Daniel (@AfroLogicInsect)
|
| 137 |
+
- Location: Lagos, Nigeria
|
| 138 |
+
- Contact: GitHub / Hugging Face / email (danielamahtoday@gmail.com)
|