# Question Answering with T5 Transformer
This project implements a question-answering task using the T5 (Text-To-Text Transfer Transformer) model, fine-tuned on the Stanford Question Answering Dataset (SQuAD). The T5 model is capable of understanding and generating human-like text, making it suitable for various NLP tasks, including question answering.
## Features
- Fine-tuning the T5 model on the SQuAD dataset
- Training and evaluation scripts
- Support for loading pre-trained models from Hugging Face
- Metrics and visualizations for model performance
## Dataset
The project uses the SQuAD dataset, a popular benchmark for machine reading comprehension. The dataset can be downloaded automatically using the Hugging Face Datasets library.
## Requirements
- Python 3.7+
- PyTorch
- Hugging Face Transformers
- Hugging Face Datasets
- tqdm
- pandas
To install all dependencies, run:
```bash
pip install -r requirements.txt-
Training the Model
Run the following command to fine-tune the T5 model on the SQuAD dataset:
python t5_qa_training.py --dataset squad --model t5-small
-
Evaluating the Model
After training, evaluate the model's performance:
python evaluate_model.py --model_path output/t5_qa_model
-
Inference
Use the trained model to answer custom questions:
python inference.py --question "What is T5?" --context "T5 is a text-to-text transfer transformer model..."
| Metric | Score |
|---|---|
| Exact Match | 59.2% |
| F1 Score | 88.4% |
t5_qa_training.py: Script for training the T5 model.evaluate_model.py: Script for evaluating the trained model.inference.py: Script for performing inference with the trained model.README.md: Project description and usage instructions.
This project is licensed under the MIT License. See the LICENSE file for details.
- Hugging Face Transformers for providing the pre-trained T5 model.
- SQuAD Dataset for the training data.