Improving Machine Reading Comprehension with General Reading Strategies
Status: Archive (code is provided as-is, no updates expected).
We re-implement the original core code that was finished at Tencent AI Lab (Bellevue). We have tested the code and made sure the code has the same performance to the original one reported in the paper.
If you find this code useful, please cite the following paper.
@inproceedings{sun2019improving,
title={Improving Machine Reading Comprehension with General Reading Strategies},
author={Sun, Kai and Yu, Dian and Yu, Dong and Cardie, Claire},
booktitle={Proceedings of the NAACL-HLT},
address={Minneapolis, MN},
url={https://arxiv.org/abs/1810.13441v2},
year={2019}
}
You can follow the instructions below to train models for RACE.
code
and create a folder named data
in it.code/data/
so that the training, development, and testing sets are in code/data/RACE/train
, code/data/RACE/dev
, and code/data/RACE/test
, respectively.python preprocess.py
to generate race_train.json
, race_dev.json
, and race_test.json
in code/data
.python gencloze.py
to generate race_train.json
, race_dev.json
, and race_test.json
in code/cloze
.model
to code/
.[dq$o]
where d
, q
, o
represent document, question, and answer option, respectively, and [
, $
, ]
represent start token, delimiter token, and end token, respectively).
python train.py --submit --n_iter 1 --data_dir cloze/
to fine-tune the original pre-trained model on the automatically generated cloze questions.python train.py --submit --n_iter 5 --resume
to fine-tune the model to RACE dataset with 5 training epochs.[o$qd]
)
python train.py --submit --n_iter 1 --data_dir cloze/ --submission_dir submission_oqd/ --save_dir save_oqd/ --log_dir log_oqd/
.python train.py --submit --n_iter 5 --resume --submission_dir submission_oqd/ --save_dir save_oqd/ --log_dir log_oqd/
.python evaluate.py
.Tips:
--n_gpu
(e.g., 8) and --n_batch
(e.g., 1) based on your environment.--seed
when running train.py
).The code has been tested with Python 3.6/3.7, Tensorflow 1.4, and Tesla P40.
You can refer to this repository for a finetuned transformer baseline based on BERT.