Skip to content

Xie-Minghui/GFC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GFC

Pytorch implementation for EMNLP 2022 paper

A Sequential Flow Control Framework for Multi-hop Knowledge Base Question Answering

Minghui Xie, Chuzhan Hao, and Peng Zhang

Overall architecture of our proposed GFC model.


The schematic diagram of the GRU-inspired Flow Control Framework.


If you find this code useful in your research, please cite

@InProceedings{xie2022gfc,
  author =  {Minghui Xie and Chuzhan Hao and Peng Zhang},
  title =   {A Sequential Flow Control Framework for Multi-hop Knowledge Base Question Answering},
  year =    {2022},  
  booktitle = {Empirical Methods in Natural Language Processing (EMNLP)},  
} 

dependencies

Prepare Datasets

For all raw data files and their corresponding preprocessed data files, we have uploaded them to google drive

We use script files from EmbedKGQA to process completed dataset of WebQSP.

WebQSP-half

We use the dataset preprocessed by EmbedKGQA.

MetaQA

You should preprocess MetaQA using MetaQA/preprocess.py

We use dataset processed by NSM.

Demo

To ensure the reproducibility, we write demo.py for all 4 main tasks. You can use pretrained model checkpoints to reproduce the results. You should put the checkpoints files into corresponding path. The checkpoints files are uploaded to google drive.

WebQSP

Enter the directory GFC/WebQSP, then input the following command.

python demo_wsp.py --input_dir data/WebQSP --save_dir checkpoints/WebQSP --ckpt checkpoints/WebQSP/model_wqsp.pt

WebQSP_half

Enter the directory GFC/WebQSP_half, then input the following command

python demo_half.py --input_dir data/WebQSP_half --save_dir checkpoints/WebQSP_half --ckpt checkpoints/WebQSP_half/model_wqsp_half.pt

CompWebQ

Enter the directory GFC/CWQ, then input the following command

python demo_cwq.py --input_dir data/CWQ --save_dir checkpoints/CWQ --ckpt checkpoints/CWQ/model_cwq.pt

MetaQA

Enter the directory GFC/CWQ, then input the following command

python demo_metaqa.py --input_dir data/Metaqa --save_dir checkpoints/Metaqa_ps --ckpt checkpoints/Metaqa/model_metaqa.pt

Experiments

We train and test simultaneously. You should enter the corresponding directory of different datasets.

WebQSP

Enter the directory GFC/WebQSP, then input the following command.

python train_hop_final.py --input_dir data/WebQSP --save_dir checkpoints/WebQSP

WebQSP_half

Enter the directory GFC/WebQSP_half, then input the following command

python train_half_hop_final.py --input_dir data/WebQSP_half --save_dir checkpoints/WebQSP_half

CompWebQ

Enter the directory GFC/CWQ, then input the following command.

python train_final.py --input_dir data/CWQ --save_dir checkpoints/CWQ --rev

MetaQA

Enter the directory GFC/MetaQA, then input the following command.

python train_final.py --glove_pt data/glove/glove.840B.300d.pickle --input_dir data/MetaQA --save_dir checkpoints/MetaQA

Acknowledgement

This repo is built upon the following work:

TransferNet: An Effective and Transparent Framework for Multi-hop Question Answering over Relation Graph. Jiaxin Shi, Shulin Cao, Lei Hou1∗, Juanzi Li1 and Hanwang Zhang. EMNLP 2021.
https://github.com/shijx12/TransferNet

Many thanks to the authors and developers!

Star History Chart

About

Official pytorch implementation of EMNLP 2022 long paper “A Sequential Flow Control Framework for Multi-hop Knowledge Base Question Answering”

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages