Git Product home page Git Product logo

opennmt-kpg-release's Introduction

Neural Keyphrase Generation

Welcome to our neural keyphrase generation repository! The goal of this project is to use language models to generate abstractive keyphrases that summarize an article.

Please follow these steps to train or evaluate our models.

Launch an AWS cloud GPU instance

This codebase requires that the machine has access to CUDA-compatible GPUs developed by NVIDIA. You can access such machines on AWS.

We assume you know how to launch an instanec on AWS. Here are a few things to keep in mind:

  • Select the latest Deep Learning AMI.
  • Select either a g4dn or a p3 instance. Note that p3 instances are faster but more expensive.

Download the data

Clone this repository using git clone.

Take a look at the data in this Google Drive folder. https://drive.google.com/drive/folders/1nJL-LC0M8lXdDEl0ZRQMc_rcuvvKO5Hb

Download the data from Google Drive into the home directory ~ of your AWS instance. There are many ways to do this. One way is to use the command-line tool gdown, which you might have to pip install. Then use the unzip command to unzip the files.

There are three important files which you should download:

  • data.zip : contains the articles and their keywords
  • magkp20k.vocab.json : contains a mapping from vocab words to their frequency in the corpus
  • models.zip : contains pre-trained models

Install the appropriate packages

Activate the conda environment conda activate pytorch_p37.

In the command line, run python setup.py install. (You can ignore the warnings it prints.)

Also run python -m spacy download 'en_core_web_sm'.

Run the training/evaluation scripts

Train

Training scripts are stored in script/empirical_study/diverse/rnn or script/empirical_study/diverse/transformer. When you run a script using the bash interpreter, make sure to alter the .sh files so that train.py is invoked with the right parameters. For example, make sure the output directory points to an existing folder on your machine.

Evaluate

We put the evaluation script in script/empirical_study/diverse/kpeval_gpu.sh. Again, look inside the script to make sure that the arguments are appropriate.

What We've Tried

For evaluation: bash script/empirical_study/diverse/kpeval_gpu.sh This runs a set of pretrained models (take a look at the script to see which) on a dataset (again take a look at the script).

For training the RNN: bash script/empirical_study/diverse/rnn/rnn-presabs-kp20k.sh This runs the training regimen from Yuan et al.

For training the transformer: bash script/empirical_study/diverse/transformer/transformer-presabs-kp20k.sh

opennmt-kpg-release's People

Contributors

srush avatar vince62s avatar bpopeters avatar sebastiangehrmann avatar jianyuzhan avatar pltrdy avatar francoishernandez avatar da03 avatar bmccann avatar guillaumekln avatar memray avatar soumith avatar eric-zhizu avatar adamlerer avatar flauted avatar helson73 avatar zenglinxiao avatar wjbianjason avatar meocong avatar waino avatar justinchiu avatar apaszke avatar xingdi-eric-yuan avatar xutaima avatar thammegowda avatar gwenniger avatar scarletpan avatar tayciryahmed avatar jsenellart avatar colesbury avatar

Forkers

mengxis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.