/QAnetEstimator

a implementation of google QAnet, a tensorflow estimator version, have very good proved performance

Primary LanguagePythonApache License 2.0Apache-2.0

QAnetEstimator

QAnetEstimator is an implementation of Google's QANet using TensorFlow's estimator API. It has been proven to have excellent performance.

overview

QAnetEstimator is a TensorFlow implementation of Google's QANet, inspired by the work done by nlplearn . While some implementation details were taken from their work, this version is a complete rewrite using TensorFlow's estimator API, dataset API, and layers API. These APIs make the code more concise and clear.

Furthermore, additional processing has been done on padding to ensure that the padding data does not affect the normal input data in the neural network. This has resulted in higher F1 and EM scores compared to nlplearn's version.

Requirements

  • Python>=3.5
  • TensorFlow>=1.10

Usage

I use a parameter to switch models (there is a bidaf flow model inside) 
--procedure "wordembedding","QAnetEmbedding","dcn","QaModelBlock","QAOutput" 
using this procedure, a qanet is built.

todo

add elmo to replace embedding layer

Result

The dataset used for this task is Stanford Question Answering Dataset I did not use it directly, but copy my network to nlplearn's qanet, you can see the replacement in my fork version ,and the comparison of result is shown below

nlplearn's em 

ulplearn em

nlplearn's f1

f1

my version's em

em

my version's f1

f1