Skip to content

twidddj/tokmangan

Repository files navigation

TensorFlow Requirement: 1.x TensorFlow 2 Not Supported

TokManGAN

codes for TokManGAN: Token Manipulation Generative Adversarial Network for Text Generation

This is a hierarchical sequence generation model, that first decides whether a blank is added or not,

if a blank is added then fill it, otherwise decides how utilize a given token (use, ignore, etc).

Instructions

1. Run TokManGAN in MLE mode

python train.py --gan_model tokmangan --mode MLE --dataset coco --unit_size 32

2. Run TokManGAN in GAN mode

python train.py --gan_model tokmangan --mode GAN --dataset coco --unit_size 32

3. Generate samples
  • For evaluation

python generate_for_eval.py -g tokmangan -t GAN -d coco -s 32

  • For checking details (You can find result files that start with 'details' in here)

python generate_for_details.py -g tokmangan -t GAN -d coco -s 32 --n_generate_per_seed 10 --gen_vd_keep_prob 0.8

  • You can also produce MaskGAN model using on this project. (specify the option in the script as --gan_model maskgan or -g maskgan)

Synthetic data experiment

  • You can find text samples synthesized in here
  • Codes for evaluation are placed in here

Requirements

  • Code is tested on TensorFlow version 1.14 for Python 3.6.
  • For evaluation you need to download the external project - GANsFallingShort

References

We have helped a lot in the following projects.