Fine-tuning t5-small(Model size
60.5M params) for dialogue summarization using the SAMSum dataset. Trained on Google Collab
This project fine-tunes a T5-small model to summarize conversations/dialogues into concise summaries. The model is trained on 4,000 dialogue-summary pairs from the SAMSum corpus.
| Split | Samples used |
|---|---|
| Train | 4,000 (sampled) |
| Validation | 500 (sampled) |
Source: knkarthick/samsum on Hugging Face.
- Base model:
t5-small(~60M parameters) - Task: Sequence-to-sequence summarization
- Tokenizer:
T5Tokenizerwith input max length 256, target max length 64
| Parameter | Value |
|---|---|
| Epochs | 6 |
| Batch size | 8 |
| Precision | bfloat16 |
| Warmup steps | 500 |
| Weight decay | 0.01 |
pip install transformers datasets torch pandas- Clone the repo and open
text_summarizer.ipynbin Jupyter or VS Code. - Run all cells in order — the notebook handles data loading, preprocessing, tokenization, and training.
- Trained checkpoints are saved to
./results/.
# Quick inference after training
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained("./results/checkpoint-best")
model = T5ForConditionalGeneration.from_pretrained("./results/checkpoint-best")
dialogue = "Hannah: Hey, can we meet tomorrow? Alex: Sure, what time? Hannah: Around 3pm?"
inputs = tokenizer("summarize: " + dialogue, return_tensors="pt", max_length=256, truncation=True)
summary_ids = model.generate(inputs["input_ids"], max_length=64)
print(tokenizer.decode(summary_ids[0], skip_special_tokens=True))text_summarizer/
├── text_summarizer.ipynb # Main training notebook
├── train.csv # Preprocessed cleaned training data
├── validation.csv # Preprocessed cleaned validation data
└── results/ # Saved model checkpoints
- Trained on Google COLLAB