A pytorch implemention of BiDAF based on CNN
The CNN module is GLDR mostly based on FAST READING COMPREHENSION WITH CONVNETS
The model encoder block is based on QAnet
- This reposity is a combination of QAnet and GLDR. I did this because QAnet need more memory with multihead attention.
- I use beam search in the evaluate process with a beam size 5 instead of traveling all the probabilities.
- Run
download.shto download the SQuAD dataset and GLOVE word embeddings. - Run
python config.py --mode preprocessto preprocess the data and start the first time training process. - Run
python config.py --mode trainto train the model orpython config.py --mode train --model modelnameto finetune a model.(eg.python config.py --mode train --model mode_final.pkl) - Run
python config.py --mode dev --model modelnameto evaluate the model and the answer file will be stored. Because this process is same as the test, I didn't duplicate the test() function.
- The model runs fast and will have a good result after 3 hours.(TiTan XP 12GB memory)
- The best score I test is F1 74 on the dev set without any finetuning. The most hyperparameters are referred from other models, I don't know whether it's good enough.
| Model | EM | F1 |
|---|---|---|
| QAnet | 73.6 | 82.7 |
| GLDR | 68.2 | 77.2 |
| BiDAF | 67.7 | 77.3 |
| FastBiDAF | 63.7 | 74.3 |
- Welcome to test my code and report your performance. If you have enough time, finetuing the model(dropout, conv layer number, etc.) is a good choice to get better results.