Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
license: mit
|
4 |
+
tags:
|
5 |
+
- summarization
|
6 |
+
- nlp
|
7 |
+
- transformer
|
8 |
+
- text-generation
|
9 |
+
- huggingface
|
10 |
+
datasets:
|
11 |
+
- cnn_dailymail
|
12 |
+
metrics:
|
13 |
+
- rouge
|
14 |
+
widget:
|
15 |
+
- text: "The quick brown fox jumps over the lazy dog. This is a sample article for testing summarization."
|
16 |
+
---
|
17 |
+
|
18 |
+
# Text Summarization Model
|
19 |
+
|
20 |
+
## Model Overview
|
21 |
+
This is a **text summarization model** built using a Seq2Seq architecture.
|
22 |
+
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.
|
23 |
+
|
24 |
+
**Intended Use:**
|
25 |
+
- Summarizing articles, documents, or reports.
|
26 |
+
- Extracting key points from text for quick understanding.
|
27 |
+
|
28 |
+
**Limitations & Biases:**
|
29 |
+
- May struggle with extremely long articles or highly technical content.
|
30 |
+
- Generated summaries may occasionally miss nuanced details.
|
31 |
+
|
32 |
+
---
|
33 |
+
|
34 |
+
|
35 |
+
## Training Details
|
36 |
+
- **Dataset**: CNN/DailyMail (3.0.0 version)
|
37 |
+
- **Preprocessing**: Truncation at 512 tokens for input, summaries capped at 150 tokens.
|
38 |
+
- **Hyperparameters**:
|
39 |
+
- Optimizer: AdamW (PyTorch)
|
40 |
+
- Learning rate: 2e-5
|
41 |
+
- Batch size: 4 (per device)
|
42 |
+
- Epochs: 10
|
43 |
+
- **Evaluation Metrics**: ROUGE-1, ROUGE-2, ROUGE-L
|
44 |
+
|
45 |
+
---
|
46 |
+
|
47 |
+
## Evaluation Results
|
48 |
+
| Metric | Score (%) |
|
49 |
+
|-----------|-----------|
|
50 |
+
| ROUGE-1 | 83.3 |
|
51 |
+
| ROUGE-2 | 60.0 |
|
52 |
+
| ROUGE-L | 83.3 |
|
53 |
+
| ROUGE-Lsum| 83.3 |
|
54 |
+
|
55 |
+
|
56 |
+
---
|
57 |
+
|
58 |
+
## Example Usage
|
59 |
+
```python
|
60 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
61 |
+
|
62 |
+
tokenizer = AutoTokenizer.from_pretrained("your-username/your-model-name")
|
63 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("your-username/your-model-name")
|
64 |
+
|
65 |
+
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."
|
66 |
+
|
67 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
|
68 |
+
summary_ids = model.generate(**inputs, max_length=150, num_beams=4, early_stopping=True)
|
69 |
+
|
70 |
+
print(tokenizer.decode(summary_ids[0], skip_special_tokens=True))
|