- In the root directory, create a new python environment and install all the requirements
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Download and unzip BERT pretrained for passage reranking in
/models/
. You should now have the following files:/models/BERT_for_passage_ranking/config.json
/models/BERT_for_passage_ranking/pytorch_model.bin
The model is taken from link which adapted BERT for passage ranking. The model is converted to PyTorch using Hugging Face's transformers library.
- Go to
src/
folder and runmain.py
with the desired question. The algorithm will print his best guess for the context:
cd src
python3 main.py --question "In what country is Normandy located?"
I didn't have the time to finish all I planned, here is what is missing:
- Fasten the computation by using batches and doing inference using torch tensor (see
src/eval.py
) - Get feedback on the actual rank of the correct context
- Implement MRR evaluation metric on dataset
- Fine-tuning the model
- Add new arguments to the parser to handle test dataset