/CPTG

implementation of Content preserving text generation with attribute controls in Pytorch

Primary LanguagePythonApache License 2.0Apache-2.0

Content Preserving Text Generation with Attribute Controls

Pytorch implementation of Content Preserving Text Generation with Attribute Controls (Logeswaran et al., 2018)

Dataset

  • You can download Yelp dataset from here
git clone https://github.com/shentianxiao/language-style-transfer.git
mv data/yelp ./
rm -rf language-style-transfer
  • You should download GLoVE
wget http://nlp.stanford.edu/data/glove.840B.300d.zip -O ./data/glove.840B.300d.zip 
unzip ./data/glove.840B.300d.zip

How to use

  • Set configuration in config.py.
  • If you want to train the model with gpu, set train=True and device = "device:0".
  • If you want to test the model, set train=False and model_path = "your model checkpoint"

Dependencies

  • python >= 3.6
  • pytorch >= 1.1
  • tqdm