Skip to content
Neural text-to-text question generation
Python HTML JavaScript Other
Branch: master
Clone or download
Latest commit af189b1 Jul 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Add model diagram Sep 26, 2018
src
.gitignore Fix disc saving. Add annotation interface for quality scoring. Extend… Aug 13, 2018
Dockerfile Get unicode to work via batched api Dec 30, 2018
Dockerfile.LM
Dockerfile.QA Add QA and LM apis Feb 7, 2019
Dockerfile.QgenWorker Add QGen celery worker Mar 5, 2019
LICENSE Add license Jan 29, 2019
README.md Readme tweaks May 7, 2019
demo.sh Remove spacy model from requirements, python path fix for demo.sh Nov 21, 2018
eval.sh Decouple TF data processing from model Jun 5, 2018
lm_train.sh Mask OOVs at eval time Jun 20, 2018
mpcm_train.sh MPCM fix - dont filter question Jun 8, 2018
requirements.txt Add QGen celery worker Mar 5, 2019
setup.sh
tensorboard.sh Tidy up Mar 7, 2018
train.sh Decouple TF data processing from model Jun 5, 2018

README.md

Neural Question Generation

Tom Hosking - MSc Project

Question Generation

Model Architecture

This repo primarily comprises an implmentation of Machine Comprehension by Text-to-Text Neural Question Generation as used for our paper Evaluating Rewards for Question Generation Models , plus a load of other research code. It is a work in progress and almost certainly contains bugs!

Requires python 3 and TensorFlow - tested on 1.4, 1.7, 1.12

tl;dr

pip install -r requirements.txt
./setup.sh
./demo.sh

Or run the demo with docker - you'll need to mount ./models and ./data

Usage

To train a model, place SQuAD and Glove datasets in ./data/ and run train.sh. To evaluate a saved model, run eval.sh. See src/flags.py for a description of available options and hyperparameters.

If you have a saved model checkpoint, you can interact with it using the demo - run python src/demo/app.py.

Code structure

TFModel provides a basic starting point and should cover generic boilerplate TF work. Seq2SeqModel implements most of the model, including a copy mechanism, encoder/decoder architecture and so on. MaluubaModel adds the extra computations required for continued training by policy gradient.

src/datasources/squad_streamer.py provides an input pipeline using TensorFlow datasets to do all the preprocessing.

src/langmodel/lm.py implements a relatively straightforward LSTM language model.

src/qa/mpcm.py implements the Multi-Perspective Context Matching QA model referenced in the Maluuba paper. NOTE: I have yet to train this successfully beyond 55% F1, there may still be bugs hidden in there.

src/discriminator/ is a modified QANet architecture, used to predict whether a context/question/answer triple is valid or not - this could be used to distinguish between generated questions and real ones or to filter out adversarial examples (eg SQuAD v2).

Citation

If you find this code useful, please cite our paper!

@misc{hosking2019evaluating,
    title={Evaluating Rewards for Question Generation Models},
    author={Tom Hosking and Sebastian Riedel},
    year={2019},
    eprint={1902.11049},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
You can’t perform that action at this time.