All Projects → ChenRocks → Fast_abs_rl

ChenRocks / Fast_abs_rl

Licence: mit
Code for ACL 2018 paper: "Fast Abstractive Summarization with Reinforce-Selected Sentence Rewriting. Chen and Bansal"

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Fast abs rl

Minerva
Meandering In Networks of Entities to Reach Verisimilar Answers
Stars: ✭ 205 (-63.97%)
Mutual labels:  natural-language-processing, reinforcement-learning
Matterport3dsimulator
AI Research Platform for Reinforcement Learning from Real Panoramic Images.
Stars: ✭ 260 (-54.31%)
Mutual labels:  natural-language-processing, reinforcement-learning
Machine Learning Notebooks
Machine Learning notebooks for refreshing concepts.
Stars: ✭ 222 (-60.98%)
Mutual labels:  natural-language-processing, reinforcement-learning
Applied Ml
📚 Papers & tech blogs by companies sharing their work on data science & machine learning in production.
Stars: ✭ 17,824 (+3032.51%)
Mutual labels:  natural-language-processing, reinforcement-learning
Tensorlayer Tricks
How to use TensorLayer
Stars: ✭ 357 (-37.26%)
Mutual labels:  natural-language-processing, reinforcement-learning
Deep Learning Drizzle
Drench yourself in Deep Learning, Reinforcement Learning, Machine Learning, Computer Vision, and NLP by learning from these exciting lectures!!
Stars: ✭ 9,717 (+1607.73%)
Mutual labels:  natural-language-processing, reinforcement-learning
Awesome Tensorlayer
A curated list of dedicated resources and applications
Stars: ✭ 248 (-56.41%)
Mutual labels:  natural-language-processing, reinforcement-learning
Notes
The notes for Math, Machine Learning, Deep Learning and Research papers.
Stars: ✭ 53 (-90.69%)
Mutual labels:  natural-language-processing, reinforcement-learning
Awesome Self Supervised Learning
A curated list of awesome self-supervised methods
Stars: ✭ 4,492 (+689.46%)
Mutual labels:  natural-language-processing, reinforcement-learning
Arxivtimes
repository to research & share the machine learning articles
Stars: ✭ 3,651 (+541.65%)
Mutual labels:  natural-language-processing, reinforcement-learning
Leakgan
The codes of paper "Long Text Generation via Adversarial Training with Leaked Information" on AAAI 2018. Text generation using GAN and Hierarchical Reinforcement Learning.
Stars: ✭ 533 (-6.33%)
Mutual labels:  natural-language-processing, reinforcement-learning
Courses
Quiz & Assignment of Coursera
Stars: ✭ 454 (-20.21%)
Mutual labels:  natural-language-processing, reinforcement-learning
Nlg Rl
Accelerated Reinforcement Learning for Sentence Generation by Vocabulary Prediction
Stars: ✭ 59 (-89.63%)
Mutual labels:  natural-language-processing, reinforcement-learning
Data Science Toolkit
Collection of stats, modeling, and data science tools in Python and R.
Stars: ✭ 169 (-70.3%)
Mutual labels:  natural-language-processing, reinforcement-learning
Demos
Some JavaScript works published as demos, mostly ML or DS
Stars: ✭ 55 (-90.33%)
Mutual labels:  natural-language-processing, reinforcement-learning
Catalyst
Accelerated deep learning R&D
Stars: ✭ 2,804 (+392.79%)
Mutual labels:  natural-language-processing, reinforcement-learning
Conversational Ai
Conversational AI Reading Materials
Stars: ✭ 34 (-94.02%)
Mutual labels:  natural-language-processing, reinforcement-learning
Blocks
Blocks World -- Simulator, Code, and Models (Misra et al. EMNLP 2017)
Stars: ✭ 39 (-93.15%)
Mutual labels:  natural-language-processing, reinforcement-learning
Deep Learning Nlp Rl Papers
Recent Deep Learning papers in NLU and RL
Stars: ✭ 288 (-49.38%)
Mutual labels:  natural-language-processing, reinforcement-learning
Mlinterview
A curated awesome list of AI Startups in India & Machine Learning Interview Guide. Feel free to contribute!
Stars: ✭ 410 (-27.94%)
Mutual labels:  natural-language-processing, reinforcement-learning

Fast Abstractive Summarization-RL

This repository contains the code for our ACL 2018 paper:

Fast Abstractive Summarization with Reinforce-Selected Sentence Rewriting.

You can

  1. Look at the generated summaries and evaluate the ROUGE/METEOR scores
  2. Run decoding of the pretrained model
  3. Train your own model

If you use this code, please cite our paper:

@inproceedings{chen2018fast,
  title={Fast Abstractive Summarization with Reinforce-Selected Sentence Rewriting},
  author={Yen-Chun Chen and Mohit Bansal},
  booktitle={Proceedings of ACL},
  year={2018}
}

Dependencies

  • Python 3 (tested on python 3.6)
  • PyTorch 0.4.0
    • with GPU and CUDA enabled installation (though the code is runnable on CPU, it would be way too slow)
  • gensim
  • cytoolz
  • tensorboardX
  • pyrouge (for evaluation)

You can use the python package manager of your choice (pip/conda) to install the dependencies. The code is tested on the Linux operating system.

Evaluate the output summaries from our ACL paper

Download the output summaries here.

To evaluate, you will need to download and setup the official ROUGE and METEOR packages.

We use pyrouge (pip install pyrouge to install) to make the ROUGE XML files required by the official perl script. You will also need the official ROUGE package. (However, it seems that the original ROUGE website is down. An alternative can be found here.) Please specify the path to your ROUGE package by setting the environment variable export ROUGE=[path/to/rouge/directory].

For METEOR, we only need the JAR file meteor-1.5.jar. Please specify the file by setting the environment variable export METEOR=[path/to/meteor/jar].

Run

python eval_acl.py --[rouge/meteor] --decode_dir=[path/to/decoded/files]

to get the ROUGE/METEOR scores reported in the paper.

Decode summaries from the pretrained model

Download the pretrained models here. You will also need a preprocessed version of the CNN/DailyMail dataset. Please follow the instructions here for downloading and preprocessing the CNN/DailyMail dataset. After that, specify the path of data files by setting the environment variable export DATA=[path/to/decompressed/data]

We provide 2 versions of pretrained models. Using acl you can reproduce the results reported in our paper. Using new you will get our latest result trained with a newer version of PyTorch library which leads to slightly higher scores.

To decode, run

python decode_full_model.py --path=[path/to/save/decoded/files] --model_dir=[path/to/pretrained] --beam=[beam_size] [--test/--val]

Options:

  • beam_size: number of hypothesis for (diverse) beam search. (use beam_size > 1 to enable reranking)
    • beam_szie=1 to get greedy decoding results (rnn-ext + abs + RL)
    • beam_size=5 is used in the paper for the +rerank model (rnn-ext + abs + RL + rerank)
  • test/val: decode on test/validation dataset

If you want to evaluate on the generated output files, please follow the instructions in the above section to setup ROUGE/METEOR.

Next, make the reference files for evaluation:

python make_eval_references.py

and then run evaluation by:

python eval_full_model.py --[rouge/meteor] --decode_dir=[path/to/save/decoded/files]

Results

You should get the following results

Validation set

Models ROUGEs (R-1, R-2, R-L) METEOR
acl
rnn-ext + abs + RL (41.01, 18.20, 38.57) 21.10
+ rerank (41.74, 18.39, 39.40) 20.45
new
rnn-ext + abs + RL (41.23, 18.45, 38.71) 21.14
+ rerank (42.06, 18.80, 39.68) 20.58

Test set

Models ROUGEs (R-1, R-2, R-L) METEOR
acl
rnn-ext + abs + RL (40.03, 17.61, 37.58) 21.00
+ rerank (40.88, 17.81, 38.53) 20.38
new
rnn-ext + abs + RL (40.41, 17.92, 37.87) 21.13
+ rerank (41.20, 18.18, 38.79) 20.56

NOTE: The original models in the paper are trained with pytorch 0.2.0 on python 2. After the acceptance of the paper, we figured it is better for the community if we release the code with latest libraries so that it becomes easier to build new models/techniques on top of our work. This results in a negligible difference w.r.t. our paper results when running the old pretrained model; and gives slightly better scores than our paper if running the new pretrained model.

Train your own models

Please follow the instructions here for downloading and preprocessing the CNN/DailyMail dataset. After that, specify the path of data files by setting the environment variable export DATA=[path/to/decompressed/data]

To re-train our best model:

  1. pretrained a word2vec word embedding
python train_word2vec.py --path=[path/to/word2vec]
  1. make the pseudo-labels
python make_extraction_labels.py
  1. train abstractor and extractor using ML objectives
python train_abstractor.py --path=[path/to/abstractor/model] --w2v=[path/to/word2vec/word2vec.128d.226k.bin]
python train_extractor_ml.py --path=[path/to/extractor/model] --w2v=[path/to/word2vec/word2vec.128d.226k.bin]
  1. train the full RL model
python train_full_rl.py --path=[path/to/save/model] --abs_dir=[path/to/abstractor/model] --ext_dir=[path/to/extractor/model]

After the training finishes you will be able to run the decoding and evaluation following the instructions in the previous section.

The above will use the best hyper-parameters we used in the paper as default. Please refer to the respective source code for options to set the hyper-parameters.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].