Dialogue summariser (Pegasus on SAMSum)
Fine-tunes Pegasus on SAMSum dialogues and serves summaries through FastAPI train and predict routes.
What it does
A config-driven pipeline downloads the SAMSum data, tokenises dialogues and summaries with the Pegasus tokenizer and fine-tunes google/pegasus-cnn_dailymail with the Hugging Face Trainer. An evaluation stage computes ROUGE-1, ROUGE-2, ROUGE-L and ROUGE-Lsum on a test sample and writes them to CSV. A FastAPI app exposes /train to rerun the pipeline and /predict to summarise text.
What was built
- 01
Stage 1 downloads and unzips the SAMSum dataset from a configured URL into artifacts.
- 02
Stage 2 tokenises dialogues and target summaries and saves the dataset to disk.
- 03
Stage 3 trains one epoch with gradient accumulation 16 and 500 warmup steps, then saves model and tokenizer.
- 04
Stage 4 scores ROUGE metrics on test samples and writes metrics.csv.
- 05
FastAPI /predict runs the fine-tuned model in a summarization pipeline; /train reruns main.py.
The pipeline, layer by layer
Five layers, one pipeline.
L1Ingestion
- SAMSum download
L2Transformation
- Pegasus tokenizer
L3Training
- Pegasus fine-tuning
- HF Trainer
L4Evaluation
- ROUGE metrics CSV
L5Serving
- FastAPI train and predict