File size: 2,354 Bytes
a21a519 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# BART-Based Text Summarization Model for News Aggregation
This repository hosts a BART transformer model fine-tuned for abstractive text summarization of news articles. It is designed to condense lengthy news reports into concise, informative summaries, enhancing user experience for news readers and aggregators.
## Model Details
- **Model Architecture:** BART (Facebook's BART-base)
- **Task:** Abstractive Text Summarization
- **Domain:** News Articles
- **Dataset:** Reddit-TIFU (Hugging Face Datasets)
- **Fine-tuning Framework:** Hugging Face Transformers
## Usage
### Installation
```bash
pip install datasets transformers rouge-score evaluate
```
### Loading the Model
```python
from transformers import BartTokenizer, BartForConditionalGeneration, Trainer, TrainingArguments, DataCollatorForSeq2Seq
import torch
# Load tokenizer and model
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model_name = "facebook/bart-base"
tokenizer = BartTokenizer.from_pretrained(model_name)
model = BartForConditionalGeneration.from_pretrained(model_name).to(device)
```
## Performance Metrics
- **Rouge1 :** 25.500000
- **Rouge2 :** 7.860000
- **Rougel :** 20.640000
- **Rougelsum :** 21.180000
## Fine-Tuning Details
### Dataset
The dataset is sourced from Hugging Faceβs Reddit-TIFU dataset. It contains 79,000 reddit post and their summaries.
The original training and testing sets were merged, shuffled, and re-split using an 90/10 ratio.
### Training Configuration
- **Epochs:** 3
- **Batch Size:** 8
- **Learning Rate:** 2e-5
- **Evaluation Strategy:** epoch
### Quantization
Post-training quantization was applied using PyTorch's built-in quantization framework to reduce the model size and improve inference efficiency.
## Repository Structure
```
.
βββ config.json
βββ tokenizer_config.json
βββ sepcial_tokens_map.json
βββ tokenizer.json
βββ model.safetensors # Fine Tuned Model
βββ README.md # Model documentation
```
## Limitations
- The model may not generalize well to domains outside the fine-tuning dataset.
- Quantization may result in minor accuracy degradation compared to full-precision models.
## Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request if you have suggestions or improvements.
|