BiSET: Bi-directional Selective Encoding with Template for Abstractive Summarization (ACL 2019)
This paper contains three basic module: Retrieve, FastRerank, Bi-selective Encoding. The following is the usage.
The Retrieve module is based on Apache Lucene, an open source search library. You should first download the core library from the website, and then build the java project. After that, you can index and search on the dataset by following steps:
- Change the path in the
Constants.javato your directory.
Indexer.javato build the index of the trainning set. (This process may cost several days, but only need once.)
Searcher.javato search for the candidates and generate the template index files.
The FastRerank module is implemented with pytorch, before run it, you should first prepare all the data (template index retrieved by Retrieve module and the raw dataset).
python config.py --mode preprocessto preprocess the data.
python config.py --mode trainto train the model or
python config.py --mode train --model modelnameto finetune a model. (eg.
python config.py --mode train --model model_final.pkl)
python config.py --mode dev --model modelnameto evaluate or test the model, and the template with highest score will be stored.
The Bi-selective Encoding module is integrated with OpenNMT. Now it only has the bi-selective encoding layer, I will add other three interaction methods (concate, multi-head attention, DCN attention) later. You can directly train it end to end with the data by following steps:
python preprocess.pyto prepare the data.
python train.pyto train the model.
python translate.pyto generate the summaries.
- If you are not familiar with Java or think the first two steps are time-consuming, you can directly train the Bi-selective Encoding module with the retrieved&reranked templates and data in Google Disk.
- I refactor my code for clearity and conciseness (rename the variables and class), but I don't have enough time to do a thorough test. If the code has some problems or you have any questions, please raise an issue, I will figure it out whenever I'm available.
- For personal communication related to BiSET, please contact me (