This is the implementation of GraftNet described in EMNLP 2018 paper Open Domain Question Answering Using Early Fusion of Knowledge Bases and Text.
The recommended way to install the required packages is using Conda and the provided environment.yml
file. See this page on how to install conda. Create the environment by running the following command:
conda env create --name=graftnet --file=environment.yml
Then activate the environment using:
source activate graftnet
Pre-processed datasets:
Pre-trained models:
To rerun the preprocessing pipeline on a different dataset, see the preprocessing folder.
This repo contains pretrained models with the full text corpus and knowledge base, and generated datasets with incomplete knowledge base (10%, 30%, 50%). The default folder structure is as follows:
GraftNet
├── *.py
├── config
├── datasets
├── webqsp
└── wikimovie
└── model
├── webqsp
└── wikimovie
To reproduce the result, (1) download data and pre-trained model, and save them under ./model and ./datasets folders respectively, and (2) change the following values in the *.yml file:
Then run the following commands:
Train:
python main.py --train config/wikimovie.yml
python main.py --train config/webqsp.yml
Test:
python main.py --test config/wikimovie.yml
python main.py --test config/webqsp.yml
Evaluate:
python script.py wikimovie KB_PRED DOC_PRED HYBRID_PRED
python script.py webqsp KB_PRED DOC_PRED HYBRID_PRED
where *_PRED are the "pred_file" in the .yml file under different settings (with different combinations of "use_doc" and "use_kb").
If you use this code please cite the following:
Sun, H., Dhingra, B., Zaheer, M., Mazaitis, K., Salakhutdinov, R., & Cohen, W. W. (2018). Open Domain Question Answering Using Early Fusion of Knowledge Bases and Text. EMNLP.
@article{sun2018open,
title={Open Domain Question Answering Using Early Fusion of Knowledge Bases and Text},
author={Sun, Haitian and Dhingra, Bhuwan and Zaheer, Manzil and Mazaitis, Kathryn and Salakhutdinov, Ruslan and Cohen, William W},
journal={EMNLP},
year={2018}
}