🚀 BoolQ T5
This repository hosts a fine - tuned T5 - base model on the BoolQ dataset, enabling the generation of true/false question - answer pairs. It leverages T5's text - to - text framework to generate natural language questions and corresponding yes/no answers from a given passage.
🚀 Quick Start
You can easily utilize this model for inference using the Hugging Face Transformers pipeline:
from transformers import pipeline
generator = pipeline("text2text-generation", model="Fares7elsadek/boolq-t5-base-question-generation")
input_text = "truefalse: [answer] passage: [Your passage here] </s>"
result = generator(input_text)
print(result)
✨ Features
- Built with PyTorch Lightning, it streamlines training, validation, and hyperparameter tuning.
- Adapts the pre - trained T5 - base model to question generation and answer prediction, bridging comprehension and generation in a single framework.
📦 Installation
No specific installation steps are provided in the original README.
💻 Usage Examples
Basic Usage
from transformers import pipeline
generator = pipeline("text2text-generation", model="Fares7elsadek/boolq-t5-base-question-generation")
input_text = "truefalse: [answer] passage: [Your passage here] </s>"
result = generator(input_text)
print(result)
📚 Documentation
Model Overview
Built with PyTorch Lightning, this implementation streamlines training, validation, and hyperparameter tuning. By adapting the pre - trained T5 - base model to the task of question generation and answer prediction, it effectively bridges comprehension and generation in a single framework.
Data Processing
Input Construction
Each input sample is formatted as follows:
truefalse: [answer] passage: [passage] </s>
Target Construction
Each target sample is formatted as:
question: [question] answer: [yes/no] </s>
The boolean answer is normalized to “yes” or “no” to ensure consistency during training.
Training Details
- Framework: PyTorch Lightning
- Optimizer: AdamW with linear learning rate scheduling and warmup
- Batch Sizes:
- Training: 6
- Evaluation: 6
- Maximum Sequence Length: 256 tokens
- Number of Training Epochs: 4
Evaluation Metrics
The model’s performance was evaluated using BLEU scores for both the generated questions and answers. For question generation, the metrics are as follows:
Property |
Details |
BLEU - 1 |
0.5143 |
BLEU - 2 |
0.3950 |
BLEU - 3 |
0.3089 |
BLEU - 4 |
0.2431 |
Note: These metrics offer a quantitative assessment of the model’s quality in generating coherent and relevant question - answer pairs.
🔧 Technical Details
The model uses a pre - trained T5 - base model and fine - tunes it on the BoolQ dataset. The data processing steps ensure that the input and target samples are in a proper format for training. The training is carried out using PyTorch Lightning with specific optimizers and hyperparameters.
📄 License
This project is licensed under the MIT license.