Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,139 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
tags: []
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 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:**
|
| 21 |
-
- **
|
| 22 |
-
- **
|
| 23 |
-
- **
|
| 24 |
-
- **
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
### Model Sources
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
| 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 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 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 |
-
|
| 69 |
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
-
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
### Training Data
|
| 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 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#### Training Hyperparameters
|
| 94 |
-
|
| 95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 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 |
-
|
| 116 |
-
|
| 117 |
-
|
| 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 |
-
|
| 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 |
-
- **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 |
-
|
| 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 |
**APA:**
|
| 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 |
-
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
|
| 193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
-
|
| 196 |
|
| 197 |
## Model Card Contact
|
| 198 |
|
| 199 |
-
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
library_name: transformers
|
| 4 |
+
tags: [text-classification, llm, huggingface, nlp, news, fine-tuning, gradio]
|
| 5 |
---
|
| 6 |
|
| 7 |
+
# 📰 NewsSense AI: LLM News Classifier with Web Scraping & Fine-Tuning
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
A fine-tuned transformer-based model that classifies news articles into five functional categories: Politics, Business, Health, Science, and Climate. The dataset was scraped from NPR using Decodo and processed with BeautifulSoup.
|
| 10 |
|
| 11 |
+
---
|
| 12 |
|
| 13 |
## Model Details
|
| 14 |
|
| 15 |
### Model Description
|
| 16 |
|
| 17 |
+
This model is fine-tuned using Hugging Face Transformers on a custom dataset of 5,000 news articles scraped directly from [NPR](https://www.npr.org/). The goal is to classify real-world news into practical categories for use in filtering, organizing, and summarizing large-scale news streams.
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
- **Developed by:** Manan Gulati
|
| 20 |
+
- **Model type:** Transformer (text classification)
|
| 21 |
+
- **Language(s):** English
|
| 22 |
+
- **License:** MIT
|
| 23 |
+
- **Fine-tuned from model:** distilbert-base-uncased
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
### Model Sources
|
| 26 |
|
| 27 |
+
- **Repository:** https://github.com/mgulati3/Fine-Tune
|
| 28 |
+
- **Demo:** https://huggingface.co/spaces/mgulati3/news-classifier-ui
|
| 29 |
+
- **Model Hub:** https://huggingface.co/mgulati3/news-classifier-model
|
| 30 |
|
| 31 |
+
---
|
|
|
|
|
|
|
| 32 |
|
| 33 |
## Uses
|
| 34 |
|
|
|
|
|
|
|
| 35 |
### Direct Use
|
| 36 |
+
This model can be used to classify any English-language news article or paragraph into one of five categories. It's useful for content filtering, feed curation, and auto-tagging of articles.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
### Out-of-Scope Use
|
| 39 |
+
- Not suitable for multi-label classification.
|
| 40 |
+
- Not recommended for non-news or informal text.
|
| 41 |
+
- May not perform well on non-English content.
|
| 42 |
|
| 43 |
+
---
|
|
|
|
|
|
|
| 44 |
|
| 45 |
## Bias, Risks, and Limitations
|
| 46 |
|
| 47 |
+
- The model is trained only on NPR articles, which may carry source-specific bias.
|
| 48 |
+
- Categories are limited to five; nuanced topics may not be accurately captured.
|
| 49 |
+
- Misclassifications may occur for ambiguous or mixed-topic content.
|
| 50 |
|
| 51 |
### Recommendations
|
| 52 |
+
Use prediction confidence scores to interpret results. Consider human review for sensitive applications.
|
| 53 |
|
| 54 |
+
---
|
| 55 |
|
| 56 |
+
## How to Get Started
|
| 57 |
|
| 58 |
+
```python
|
| 59 |
+
from transformers import pipeline
|
| 60 |
|
| 61 |
+
classifier = pipeline("text-classification", model="mgulati3/news-classifier-model")
|
| 62 |
+
classifier("NASA's new moon mission will use AI to optimize fuel consumption.")
|
| 63 |
+
```
|
| 64 |
|
| 65 |
+
---
|
| 66 |
|
| 67 |
## Training Details
|
| 68 |
|
| 69 |
### Training Data
|
| 70 |
+
Scraped 5,000 articles from NPR using Decodo (with proxy rotation and JS rendering). Articles were cleaned and labeled across five categories using Python and pandas.
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
### Training Procedure
|
| 73 |
|
| 74 |
+
- Tokenizer: LLaMA-compatible tokenizer
|
| 75 |
+
- Preprocessing: Lowercasing, truncation, padding
|
| 76 |
+
- Epochs: 4
|
| 77 |
+
- Optimizer: AdamW
|
| 78 |
+
- Batch size: 16
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
## Evaluation
|
| 83 |
|
| 84 |
+
### Testing Data
|
| 85 |
+
20% of the dataset was reserved for testing. Random stratified split was used.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
+
### Metrics
|
| 88 |
+
- Accuracy (Train): 85%
|
| 89 |
+
- Accuracy (Test): 60%
|
| 90 |
+
- Metric: Accuracy (single-label, top-1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
### Results
|
| 93 |
+
The model performs well on domain-specific, labeled news content with distinguishable category patterns.
|
| 94 |
|
| 95 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
## Environmental Impact
|
| 98 |
|
| 99 |
+
- **Hardware Type:** Google Colab GPU (T4)
|
| 100 |
+
- **Hours used:** ~2.5
|
| 101 |
+
- **Cloud Provider:** Google
|
| 102 |
+
- **Compute Region:** US
|
| 103 |
+
- **Carbon Emitted:** Estimated ~0.2 kgCO2eq
|
| 104 |
|
| 105 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
+
## Technical Specifications
|
| 108 |
|
| 109 |
+
### Model Architecture
|
| 110 |
+
DistilBERT architecture fine-tuned for single-label text classification using a softmax output layer over 5 categories.
|
| 111 |
|
| 112 |
### Compute Infrastructure
|
| 113 |
+
- Google Colab Pro
|
| 114 |
+
- Python 3.10
|
| 115 |
+
- Hugging Face Transformers 4.x
|
| 116 |
+
- PyTorch backend
|
| 117 |
|
| 118 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
## Citation
|
| 121 |
|
| 122 |
**APA:**
|
| 123 |
|
| 124 |
+
Gulati, M. (2025). NewsSense AI: Fine-tuned LLM for News Classification. https://huggingface.co/mgulati3/news-classifier-model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
+
**BibTeX:**
|
|
|
|
|
|
|
| 127 |
|
| 128 |
+
@misc{gulati2025newssense,
|
| 129 |
+
author = {Gulati, Manan},
|
| 130 |
+
title = {NewsSense AI: Fine-tuned LLM for News Classification},
|
| 131 |
+
year = {2025},
|
| 132 |
+
url = {https://huggingface.co/mgulati3/news-classifier-model}
|
| 133 |
+
}
|
| 134 |
|
| 135 |
+
---
|
| 136 |
|
| 137 |
## Model Card Contact
|
| 138 |
|
| 139 |
+
For questions or collaborations: mgulati3@asu.edu
|