Update README.md
Browse files
README.md
CHANGED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
datasets:
|
4 |
+
- cnn_dailymail
|
5 |
+
tags:
|
6 |
+
- summarization
|
7 |
+
- t5
|
8 |
+
- flan-t5
|
9 |
+
- transformers
|
10 |
+
- huggingface
|
11 |
+
- fine-tuned
|
12 |
+
license: apache-2.0
|
13 |
+
model-index:
|
14 |
+
- name: FLAN-T5 Base Fine-Tuned on CNN/DailyMail
|
15 |
+
results:
|
16 |
+
- task:
|
17 |
+
type: summarization
|
18 |
+
name: Summarization
|
19 |
+
dataset:
|
20 |
+
name: CNN/DailyMail
|
21 |
+
type: cnn_dailymail
|
22 |
+
metrics:
|
23 |
+
- type: rouge
|
24 |
+
value: 25.33
|
25 |
+
name: Rouge-1
|
26 |
+
- type: rouge
|
27 |
+
value: 11.96
|
28 |
+
name: Rouge-2
|
29 |
+
- type: rouge
|
30 |
+
value: 20.68
|
31 |
+
name: Rouge-L
|
32 |
+
metrics:
|
33 |
+
- rouge
|
34 |
+
base_model:
|
35 |
+
- google/flan-t5-base
|
36 |
+
pipeline_tag: summarization
|
37 |
+
---
|
38 |
+
|
39 |
+
# FLAN-T5 Base Fine-Tuned on CNN/DailyMail
|
40 |
+
|
41 |
+
This model is a fine-tuned version of [`google/flan-t5-base`](https://huggingface.co/google/flan-t5-base) on the [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail) dataset using the Hugging Face Transformers library.
|
42 |
+
|
43 |
+
## 📝 Task
|
44 |
+
|
45 |
+
**Abstractive Summarization**: Given a news article, generate a concise summary.
|
46 |
+
|
47 |
+
---
|
48 |
+
|
49 |
+
## 📊 Evaluation Results
|
50 |
+
|
51 |
+
The model was fine-tuned on 20,000 training samples and validated/tested on 2,000 samples. Evaluation was performed using ROUGE metrics:
|
52 |
+
|
53 |
+
| Metric | Score |
|
54 |
+
|-------------|--------|
|
55 |
+
| ROUGE-1 | 25.33 |
|
56 |
+
| ROUGE-2 | 11.96 |
|
57 |
+
| ROUGE-L | 20.68 |
|
58 |
+
| ROUGE-Lsum | 23.81 |
|
59 |
+
|
60 |
+
---
|
61 |
+
|
62 |
+
## 📦 Usage
|
63 |
+
|
64 |
+
```python
|
65 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
66 |
+
|
67 |
+
model = T5ForConditionalGeneration.from_pretrained("AbdullahAlnemr1/flan-t5-summarizer")
|
68 |
+
tokenizer = T5Tokenizer.from_pretrained("AbdullahAlnemr1/flan-t5-summarizer")
|
69 |
+
|
70 |
+
input_text = "summarize: The US president met with the Senate to discuss..."
|
71 |
+
inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True)
|
72 |
+
|
73 |
+
summary_ids = model.generate(inputs["input_ids"], max_length=128, num_beams=4, early_stopping=True)
|
74 |
+
print(tokenizer.decode(summary_ids[0], skip_special_tokens=True))
|