Skip to content

dirkweissenborn/jack

 
 

Repository files navigation

Jack the Reader Wercker build badge codecov Gitter

A reading comprehension framework.
  • All work and no play makes Jack a great framework!
  • All work and no play makes Jack a great framework!
  • All work and no play makes Jack a great framework!

Jack the Reader -- or jack, for short -- is a framework for building an testing models on a variety of tasks that require reading comprehension.

To get started, please see How to Install and Run and then you may want to have a look at the notebooks. Lastly, for a high-level explanation of the ideas and vision, see Understanding Jack the Reader.

Quickstart Examples - Training and Usage of a Question Answering System

To illustrate how jack works, we will show how to train a question answering model.

Extractive Question Answering on SQuAD

First, download SQuAD and GloVe embeddings:

$ cd data/SQuAD/
$ ./download.sh
$ cd ../GloVe/
$ ./download.sh
$ cd ../..

Train a FastQA model

$ python3 jack/train_reader.py with config='./conf/fastqa.yaml'

Note, you can add a flag tensorboard_folder=.tb/fastqa to write tensorboard summaries to a provided path (here .tb/fastqa).

A copy of the model is written into the model_dir directory after each training epoch. These can be loaded using the commands below or see e.g. the showcase notebook.

from jack import readers
from jack.core import QASetting

fastqa_reader = readers.reader_from_file("./fastqa_reader")

support = """"It is a replica of the grotto at Lourdes, 
France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. 
At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), 
is a simple, modern stone statue of Mary."""

answers = fastqa_reader([QASetting(
    question="To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?",
    support=[support]
)])

Recognizing Textual Entailment on SNLI

First, download SNLI

$ ./data/SNLI/download.sh

Lastly, train a Decomposable Attention Model

$ python3 jack/train_reader.py with config=tests/test_conf/dam_test.yaml
from jack import readers
from jack.core import QASetting

dam_reader = readers.dam_snli_reader()
dam_reader.load_and_setup("tests/test_results/dam_reader_test")

answers = dam_reader([QASetting(
    question="The boy plays with the ball.",
    support=["The boy plays with the ball."]
)])

Support

We are thankful for support from:

Developer guidelines

$ python3 ./jack/io/SNLI2jtr_v1.py

About

Jack the Reader

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 47.2%
  • HTML 21.9%
  • Jupyter Notebook 16.1%
  • JavaScript 11.1%
  • CSS 2.9%
  • Shell 0.6%
  • Makefile 0.2%