Giter Club home page Giter Club logo

hsgn_099n's Introduction

Thesis

First of all, you need to run ./prepare_data.sh to create download HotpotQA and put it in the right folder.

The code contained in this repository is divided into two parts: i) graph creation and ii) model (training and inference)

Graph Creation

The graphs corresponding to each HotpotQA instance can be created with ./src/data/bottom_up_query_edges.py. You will need to specify the folder where you want to store the graphs in this script. I used the following folders ./data/processed/training/YOUR_FOLDER for the graphs of the training set. This scripts assumes the existence of the following files:

  • List of named entities in each question (list_ent_query_training.p)
  • List of named entities in each paragaph (list_hotpot_ner_no_coref_train.p)
  • List of SRL args in each question (dict_ins_query_srl_triples_training.json)
  • List of SRL args in each paragraph (dict_ins_doc_sent_srl_triples.json)

You can create them following ./src/data/preprocess_dataset.py (you would need to modify a bit the code to add a few lines to store these files) or download them (link at the end of this readme).

Training the Model

The script ./src/models/GAT_Hierar_Tok_Node_Aggr.py takes ./data/processed/training/YOUR_FOLDER (you need to specify it at the begining when loading the graphs) and trains the model. The checkpoints of the model are saved in ./models/YOUR_CHECKPOINT. This path is defined in the variable model_path.

Inference

First you need some files and pretrained models:

  • Put the input file (HotpotQA dev/test set) on ./data/external/input.json
  • Put the pretrained graphQA model on ./models/graph_model
  • Put the SRL model link on ./models/srl_model. Do not untar it.

Now you can execute ./run.sh. This will execute the pragraph selection stage of SAE (Tu et al., 2020), then it will create the graphs for those predicted paragraphs, and lastly will inference to obtain the predicted answers.

Intermediate Files

Precreated Graphs

Pretrained Model

hsgn_099n's People

Contributors

haritzpuerto avatar trellixvulnteam avatar patchtester 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.