Giter Club home page Giter Club logo

gfc's Introduction

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

gfc's People

Contributors

xie-minghui avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.