This repository contains the implementation of the Bidirectional Attention Flow (BiDAF) model for machine reading comprehension and question-answering tasks. The BiDAF model is designed to process context and query to provide precise answers from a given passage.
Bidaf.ipynb
: Jupyter Notebook containing the implementation and training workflow for the BiDAF model.Bidaf.py
: Python script version of the BiDAF implementation for users who prefer non-notebook environments.Data.zip
: Compressed dataset file containing the training and validation data for BiDAF. Unzip this file before running the code.bidafglove_tv.npy
: Pre-trained GloVe embeddings used for training the BiDAF model.bidaftrain.pkl
: Serialized training dataset in Python pickle format.bidafvalid.pkl
: Serialized validation dataset in Python pickle format.
- Implementation of BiDAF model for question-answering tasks.
- Utilizes pre-trained GloVe embeddings for word representation.
- Support for training and validation workflows.
- Jupyter Notebook for experimentation and Python script for streamlined execution.
- Python 3.7 or higher
- Required Python libraries:
numpy
pandas
torch
tqdm
pickle
Install the dependencies using:
pip install -r requirements.txt
- Unzip the
Data.zip
file to extract the training and validation datasets. - Ensure the
.pkl
and.npy
files are in the same directory as the scripts or notebooks.
- For interactive experimentation, open
Bidaf.ipynb
in Jupyter Notebook:jupyter notebook Bidaf.ipynb
- For command-line execution, use the
Bidaf.py
script:python Bidaf.py
The model's performance can be evaluated using standard metrics like Exact Match (EM) and F1 score. These scores are calculated on the validation dataset.