Coder Social home page Coder Social logo

qanet's Introduction

Overview

Implementation for QANet using Keras with Tensorflow backend.

Preparation (QANet implementation)

Setting variables are defined in src/squad/config.py

  1. Preparation

    • Install Python packages in requirements.txt
    • Install English corpus for Spacy: python -m spacy download en
  2. Download glove and extract the file glove.6B.300d.txt to data/glove (Setting variable: EMBEDDING_FILE)

  3. Download SQuAD data v1.1 and extract the files train-v1.1.json & dev-v1.1.json to data/SQUAD_Data/v1.1 (Setting variable: TRAIN_JSON & DEV_JSON)

For inference using pre-trained model

  • Download the model file qanet_ep20.h5 from https://github.com/nptdat/qanet/releases/download/v1.0/qanet_ep20.h5 and put it into model folder. (Setting variable: INFERENCE_MODEL_PATH)

  • If you use the above model, I recommend you to download the following files from https://github.com/nptdat/qanet/releases/download/v1.0 to ensure the data consistence:

    • squad_processed-v1.1.pkl.zip: unzip and move the pickle file to data/SQUAD_Data/v1.1/
    • numpy_files.zip: unzip and move all the .npy files to data/SQUAD_Data/v1.1/numpy/
    • Data from these files will overwrite those generated from build_squad_data.py
  • Run

$ FLASK_APP=demo_qanet.py flask run --host=0.0.0.0 --port=8080

Then access http://localhost:8080/qanet via browser.

For training

  1. Run build_squad_data.py to load SQuAD data from json files, transform the data and save to .pkl files
$ python build_squad_data.py
  1. Run train.py
$ python train.py
  • Model files will be saved to model folder, 1 model per epoch
  • Tensorboard log data will be saved to log/tensorboard
  • Please take a look at config.py for further setting

Unit Test

Please read src/squad/test/README.md

qanet's People

Contributors

nptdat avatar

Stargazers

Do Minh Hai avatar  avatar Soumik Rakshit avatar Jeff Zhou avatar  avatar  avatar Cinkate Ren avatar  avatar Nhan Nguyen avatar Khanh Tran avatar Van Huy avatar Khang avatar

Watchers

James Cloos avatar  avatar paper2code - bot 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.