N.B. Includes a Pytorch implementation of Get To The Point: Summarization with Pointer-Generator Networks Base version reference: pointer_summerizer
- To train an initial Seq-2-Seq Network run the
training_ptr_gen/train_pytorch.pyfile - To train the Network using the Policy Gradient run the
seqGAN/main.pyfile (be sure to point to your pretrained Seq2Seq model if you want good results). The default reward level is the global sentence level reward. - Pass
--word-levelto train with local word level rewards - Pass
--combinedto train with the combined rewards - Adjust the
data_util/config.pyas necessary to adjust paths and training settings - N.B. You may need to run
export PYTHONPATH=$PYTHONPATH:'pwd'in order to properly configure the references
- Follow data generation instruction from https://github.com/abisee/cnn-dailymail
- Requires python 3.x and pytorch 0.4
- To install the dependencies run
pip install -r requirements.txt - In order to evaluate results using the ROUGE metric please follow the instructions below (a working PERL installation is required)
- Clone old PyRouge Repository into separate directory
git clone https://github.com/andersjo/pyrouge.git pyrouge_ancient - Clone new PyRouge Repository
git clone https://github.com/bheinzerling/pyrouge.git - Run
pip install pyrouge - Set the Rouge-1.5.5 Installation Directory (N.B. This needs to be an absolute path!!!)
pyrouge_set_rouge_path <absolute_path_of_current_directory>/pyrouge_ancient/tools/ROUGE-1.5.5/ - Run
cd pyrouge - Check to see if it worked by running
python -m pyrouge.test
- Follow the install instructions of
git clone https://github.com/pltrdy/rouge
- Note: For training passing the initial checkpoint is optional argument, but for evaluation and decoding passing the checkpoint is must.
- For evaluation and decoding:
python training_ptr_gen/eval.py <absolute/path/to/model/checkpoint>
python training_ptr_gen/decode.py <absolute/path/to/model/checkpoint>