Coder Social home page Coder Social logo

styleeq's Introduction

styleeq

Code for Low-Level Linguistic Controls for Style Transfer and Content Preservation

INSTALL LIBRARY

First install plum:

$ python setup.py install

Then download the spacy model data:

$ python -m spacy download en_core_web_sm

Then setup the eval scripts:

$ cd eval_scripts; ./install.sh; cd ..

DOWNLOAD DATA

./download_data.sh

Data will apear in a directory called literary_style_data.

DOWNLOAD MODELS

Instead of training your own models, you can use our models we used for the paper by downloading them. Simply run:

./download_models.sh

Models will appear in a directory called style_models.

Train

To train the StyleEQ model run:

$ plumr configs/styleeq.jsonnet --proj style_models/styleeq --run train --gpu GPUNUM

where GPUNUM is the number of the gpu you want to run on. -1 will run on cpu but this is not practical.

To evaluate the model with automatic quality metrics on the test, after training, run:

$ plumr configs/styleeq.jsonnet --proj style_models/styleeq --run eval-test --gpu GPUNUM

Generation Example

To see how to generate text/perform style transfer see the example generation script, generation_example.py.

This gives an example of generating from data already in the format of the jsonl data that you can download above, and how to convert a raw string to that format. To convert a raw string to the correct format requires the Stanford Core NLP library. To download run:

$ wget http://nlp.stanford.edu/software/stanford-corenlp-full-2018-10-05.zip

$ unzip stanford-corenlp-full-2018-10-05.zip

To run the generation script, run:

$ python generation_example.py style_models/styleeq/ literary_style_data stanford-corenlp-full-2018-10-05

styleeq's People

Contributors

kedz avatar

Stargazers

Mingda Zhang avatar Clair Marie avatar

Watchers

James Cloos avatar  avatar

Forkers

liangtao123

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.