File size: 2,017 Bytes
bf147eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language: en
license: mit
tags:
- summarization
- nlp
- transformer
- text-generation
- huggingface
datasets:
- cnn_dailymail
metrics:
- rouge
widget:
- text: "The quick brown fox jumps over the lazy dog. This is a sample article for testing summarization."
---

# Text Summarization Model

## Model Overview
This is a **text summarization model** built using a Seq2Seq architecture.  
It was trained on the **CNN/DailyMail dataset (3.0.0)** and is capable of generating concise summaries of news articles or other long-form texts.

**Intended Use:**  
- Summarizing articles, documents, or reports.  
- Extracting key points from text for quick understanding.

**Limitations & Biases:**  
- May struggle with extremely long articles or highly technical content.  
- Generated summaries may occasionally miss nuanced details.

---


## Training Details
- **Dataset**: CNN/DailyMail (3.0.0 version)  
- **Preprocessing**: Truncation at 512 tokens for input, summaries capped at 150 tokens.  
- **Hyperparameters**:  
  - Optimizer: AdamW (PyTorch)  
  - Learning rate: 2e-5  
  - Batch size: 4 (per device)  
  - Epochs: 10  
- **Evaluation Metrics**: ROUGE-1, ROUGE-2, ROUGE-L  

---

## Evaluation Results
| Metric    | Score (%) |
|-----------|-----------|
| ROUGE-1   | 83.3      |
| ROUGE-2   | 60.0      |
| ROUGE-L   | 83.3      |
| ROUGE-Lsum| 83.3      |


---

## Example Usage
```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("your-username/your-model-name")
model = AutoModelForSeq2SeqLM.from_pretrained("your-username/your-model-name")

text = "The stock market saw a significant drop today due to rising inflation concerns. Investors are cautious ahead of the Federal Reserve's upcoming decision."

inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
summary_ids = model.generate(**inputs, max_length=150, num_beams=4, early_stopping=True)

print(tokenizer.decode(summary_ids[0], skip_special_tokens=True))