Git Product home page Git Product logo

bag's Introduction

BAG

Implementation for NAACL-2019 paper

BAG: Bi-directional Attention Entity Graph Convolutional Network forMulti-hop Reasoning Question Answering

BAG Framework

Requirement

  1. Python 3.6
  2. TensorFlow >= 1.11.0
  3. Pytorch >= 0.4.1
  4. SpaCy >= 2.0.12 (You need to install "en" module via )
  5. allennlp >= 0.7.1
  6. nltk >= 3.3

And some other packages

I run it using two NVIDIA GTX1080Ti GPUs each one has 11GB memory. To run it with default batch size 32, at least 16GB memory is needed.

How to run

  • Before run

You need to download pretrained 840B 300d GLoVe embeddings, and pretrained original size ELMo embedding weights and options and put them under directory /data.

  • Preprocessing dataset

You need to download QAngaroo WIKIHOP dataset , unzip it and put the json files under the root directory. Then run prerpocessing script

python prepro.py {json_file_name}

It will generate four preprocessed pickle file in the root directory which will be used in the training or prediction.

  • Train the model

Train the model using following command which will follow the configure in original paper

python BAG.py {train_json_file_name} {dev_json_file_name} --use_multi_gpu=true

Please make sure you have run preprocessing for both train file and dev file before training. And please make sure you have CUDA0 and CUDA1 available. If you have single GPU with more than 16GB memory, you can remove parameter --use_multi_gpu.

  • Predict

After training it will put trained model onto directory /models. You can predict the answer of a json file using following command

python BAG.py {predict_json_file_name} {predict_json_file_name} --use_multi_gpu=true --evaluation_mode=true

bag's People

Contributors

caoyu-noob avatar

Watchers

James Cloos 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.