Skip to content

Dara4hem/SQuAD_QA_Transformer-Decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

# 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

Usage

  1. 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
  2. Evaluating the Model

    After training, evaluate the model's performance:

    python evaluate_model.py --model_path output/t5_qa_model
  3. 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..."

Results

Metric Score
Exact Match 59.2%
F1 Score 88.4%

Project Structure

  • 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.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

About

A Python implementation for a question-answering task using the T5 Transformer model, trained on the SQuAD dataset. This project demonstrates how to fine-tune a pre-trained T5 model for answering questions based on given passages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors