Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,99 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- knkarthick/dialogsum
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
metrics:
|
8 |
+
- rouge
|
9 |
+
base_model:
|
10 |
+
- google/flan-t5-small
|
11 |
+
tags:
|
12 |
+
- t5
|
13 |
+
- flan
|
14 |
+
- fine-tuned
|
15 |
+
- instruction
|
16 |
+
---
|
17 |
+
|
18 |
+
# FLAN-T5-small Dialogue Summarization
|
19 |
+
|
20 |
+
## Model Description
|
21 |
+
Fine-tuned **FLAN-T5-small** model for dialogue summarization tasks using the DialogSum dataset. Achieves improved performance in generating concise summaries from conversational dialogues.
|
22 |
+
|
23 |
+
## Training Data
|
24 |
+
- **Dataset**: DialogSum (1,837 annotated dialogues)
|
25 |
+
- **Preprocessing**: prompt_template = """
|
26 |
+
Here is a dialogue:
|
27 |
+
{dialogue}
|
28 |
+
Write a short summary.
|
29 |
+
{summary}
|
30 |
+
"""
|
31 |
+
|
32 |
+
Converted original dataset into instruction format with dialogue-summary pairs
|
33 |
+
|
34 |
+
## Training Setup
|
35 |
+
| Parameter | Value |
|
36 |
+
|-----------|-------|
|
37 |
+
| Base Model | google/flan-t5-small |
|
38 |
+
| Epochs | 5 |
|
39 |
+
| Batch Size | 16 (per device) |
|
40 |
+
| Learning Rate | 3e-4 |
|
41 |
+
| Optimizer | Adafactor |
|
42 |
+
| Mixed Precision | fp16 |
|
43 |
+
| Gradient Accumulation | 4 steps |
|
44 |
+
| Max Length | 512 tokens |
|
45 |
+
|
46 |
+
## Evaluation Results
|
47 |
+
| Metric | Value |
|
48 |
+
|--------|-------|
|
49 |
+
| ROUGE-1 | 0.174 |
|
50 |
+
| ROUGE-2 | 0.045 |
|
51 |
+
| ROUGE-L | 0.135 |
|
52 |
+
|
53 |
+
## Basic Inference
|
54 |
+
|
55 |
+
```python
|
56 |
+
from transformers import pipeline
|
57 |
+
summarizer = pipeline(
|
58 |
+
"text2text-generation",
|
59 |
+
model="your_hf_username/your_model_name"
|
60 |
+
)
|
61 |
+
dialogue_example = """
|
62 |
+
A: The router keeps disconnecting every hour.
|
63 |
+
B: Have you tried firmware update?
|
64 |
+
A: Not yet, how do I do that?
|
65 |
+
B: Download latest version from our support site.
|
66 |
+
"""
|
67 |
+
summary = summarizer(
|
68 |
+
f"Summarize this dialogue:\n{dialogue_example}\nSummary:",
|
69 |
+
max_length=150,
|
70 |
+
num_beams=3
|
71 |
+
)['generated_text']
|
72 |
+
print(summary)
|
73 |
+
```
|
74 |
+
|
75 |
+
## Training Procedure
|
76 |
+
- **Hardware**: T4 GPU on Kaggle
|
77 |
+
- **Framework**: PyTorch with Hugging Face Transformers
|
78 |
+
- **Training Time**: ~45 minutes (Kaggle free tier)
|
79 |
+
|
80 |
+
## Recommendations
|
81 |
+
- Use beam search (num_beams=3-5) for better results
|
82 |
+
- Combine with post-processing for formatting
|
83 |
+
- Fine-tune longer for complex dialogues
|
84 |
+
|
85 |
+
## Limitations
|
86 |
+
- Struggles with multi-topic dialogues
|
87 |
+
- May miss subtle contextual cues
|
88 |
+
- Best performance on short conversations (<500 tokens)
|
89 |
+
|
90 |
+
## License
|
91 |
+
Apache 2.0 (Same as base FLAN-T5 model)
|
92 |
+
|
93 |
+
## Citation
|
94 |
+
@misc{dialogsum2021,
|
95 |
+
title={DialogSum: A Real-Life Scenario Dialogue Summarization Dataset},
|
96 |
+
author={Karthick Krishnamurthy},
|
97 |
+
year={2021},
|
98 |
+
howpublished={HuggingFace Datasets},
|
99 |
+
}
|