Code Monkey home page Code Monkey logo

qanet-pytorch's Introduction

QANet-pytorch

Introduction

An implementation of QANet with PyTorch, using SQuAD 1.1.

Any contributions are welcome!

Usage

  1. Install pytorch 0.4 for Python 3.6+
  2. Run pip install cython spacy tqdm ujson absl-py
  3. Run download.sh to download the dataset.
  4. Run python main.py --mode data to build tensors from the raw dataset.
  5. Run python main.py --mode train to train the model. After training, log/model.pt will be generated.
  6. Run python main.py --mode test to test an pretrained model. Default model file is log/model.pt

Structure

preproc.py: downloads dataset and builds input tensors.

main.py: program entry; functions about training and testing.

models.py: QANet structure.

config.py: configurations.

Differences from the paper

  1. The paper doesn't mention which activation function they used. I use relu.
  2. I don't set the embedding of <UNK> trainable.
  3. The connector between embedding layers and embedding encoders may be different from the implementation of Google, since the description in the paper is inconsistent (residual block can't be used because the dimensions of input and output are different) and they don't say how they implemented it.

TODO

  • Reduce memory usage
  • Performance analysis
  • Reach state-of-art scroes of the original paper
  • Test on SQuAD 2.0
  • Ablation analysis

Contributors

  1. InitialBug: found two bugs: (1). positional encodings require gradients; (2). wrong weight sharing among encoders.
  2. linthieda: fixed one issue about dependencies and offered computing resources.

qanet-pytorch's People

Contributors

gen-ko avatar hengruo avatar

Watchers

 avatar  avatar  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.