Git Product home page Git Product logo

nonmonotonic_text's Introduction

Non-Monotonic Sequential Text Generation

PyTorch implementation of the paper:

Non-Monotonic Sequential Text Generation
Sean Welleck, Kiante Brantley, Hal Daume III, Kyunghyun Cho
ICML 2019

We present code and data for training models described in the paper, and notebooks for evaluating pre-trained models.

Installation

python setup.py develop

Data

For downloading the datasets below, it may be helpful to use gdown.pl.

Persona Chat (Unconditional Generation, Word-Reordering)

  • Google drive
  • Put the .jsonl files into a directory {PCHAT_DIR}.

Machine Translation

  • Google drive
  • Unzip the dataset, e.g. to /path/to/iwslt. Then {MT_DIR} below will be /path/to/iwslt/IWSLT/en-de/.

Using a Pretrained Model

You can use and evaluate pre-trained models in one of the provided notebooks:

Task Models Notebook
Word Reordering Google drive notebooks/word_reorder_eval.ipynb
Unconditional Generation Google drive notebooks/unconditional_eval.ipynb
Translation (Transformer) Google drive notebooks/translation_eval.ipynb

The word-reordering and translation notebooks reproduce the evaluation metrics (e.g. BLEU) in the paper.

The unconditional notebook demos the models via interactive sampling and tree completion.

Training

First download and unzip GloVe vectors into a directory {GLOVE_DIR}.

Word-Reordering

python tree_text_gen/binary/bagorder/train.py --glovepath {GLOVE_DIR}/glove.840B.300d.txt \
                                              --datadir {PCHAT_DIR} 

Unconditional Generation

python tree_text_gen/binary/unconditional/train.py --glovepath {GLOVE_DIR}/glove.840B.300d.txt \
                                                   --datadir {PCHAT_DIR} 

Machine Translation (Transformer)

python tree_text_gen/binary/translation/train_transformer.py --datadir {MT_DIR}

Use --multigpu for multi-GPU.

Machine Translation (LSTM)

python tree_text_gen/binary/translation/train.py --datadir {MT_DIR} --model-type translation \
                                                 --beta-burnin 2 --beta-step 0.05 \
                                                 --self-teach-beta-step 0.05

By default these commands train policies with the annealed oracle. See tree_text_gen/{bagorder, unconditional, translation}/args.py for hyper-parameters and arguments.

nonmonotonic_text's People

Contributors

wellecks avatar

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.