- 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.
To illustrate how jack works, we will show how to train a question answering model.
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]
)])
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."]
)])
We are thankful for support from:
- Comply with the PEP 8 Style Guide
- Make sure all your code runs from the top level directory, e.g.:
$ python3 ./jack/io/SNLI2jtr_v1.py