rnn.wgan
1.0.0
培训和评估该模型的代码,来自“具有反复生成对抗网络的语言产生而无需预训练”。
本文提供了简短的摘要。
" There has been to be a place w
On Friday , the stories in Kapac
From should be taken to make it
He is conference for the first t
For a lost good talks to ever ti
要开始训练CL+VL+TH模型,请首先下载数据集,可在http://www.statmt.org/lm-benchmark/上找到,然后将其提取到./data目录中。
然后使用以下命令:
python curriculum_training.py
需要以下包:
可以配置以下参数:
LOGS_DIR: Path to save model checkpoints and samples during training (defaults to './logs/')
DATA_DIR: Path to load the data from (defaults to './data/1-billion-word-language-modeling-benchmark-r13output/')
CKPT_PATH: Path to checkpoint file when restoring a saved model
BATCH_SIZE: Size of batch (defaults to 64)
CRITIC_ITERS: Number of iterations for the discriminator (defaults to 10)
GEN_ITERS: Number of iterations for the geneartor (defaults to 50)
MAX_N_EXAMPLES: Number of samples to load from dataset (defaults to 10000000)
GENERATOR_MODEL: Name of generator model (currently only 'Generator_GRU_CL_VL_TH' is available)
DISCRIMINATOR_MODEL: Name of discriminator model (currently only 'Discriminator_GRU' is available)
PICKLE_PATH: Path to PKL directory to hold cached pickle files (defaults to './pkl')
ITERATIONS_PER_SEQ_LENGTH: Number of iterations to run per each sequence length in the curriculum training (defaults to 15000)
NOISE_STDEV: Standard deviation for the noise vector (defaults to 10.0)
DISC_STATE_SIZE: Discriminator GRU state size (defaults to 512)
GEN_STATE_SIZE: Genarator GRU state size (defaults to 512)
TRAIN_FROM_CKPT: Boolean, set to True to restore from checkpoint (defaults to False)
GEN_GRU_LAYERS: Number of GRU layers for the genarator (defaults to 1)
DISC_GRU_LAYERS: Number of GRU layers for the discriminator (defaults to 1)
START_SEQ: Sequence length to start the curriculum learning with (defaults to 1)
END_SEQ: Sequence length to end the curriculum learning with (defaults to 32)
SAVE_CHECKPOINTS_EVERY: Save checkpoint every # steps (defaults to 25000)
LIMIT_BATCH: Boolean that indicates whether to limit the batch size (defaults to true)
可以通过更改配置文件中的值或通过在终端传递其值来设置参数:
python curriculum_training.py --START_SEQ=1 --END_SEQ=32
generate.py脚本将使用保存的模型生成BATCH_SIZE样本。应该使用用于训练模型的参数(如果它们与默认值不同)进行运行。例如:
python generate.py --CKPT_PATH=/path/to/checkpoint/seq-32/ckp --DISC_GRU_LAYERS=2 --GEN_GRU_LAYERS=2
(如果您的模型尚未到达课程中的第32阶段,请确保将上述路径中的“ 32”更改为模型训练的课程中的最大阶段。)
要使用我们的%-in-intest-N指标评估样本,请使用以下命令,链接到TXT文件,其中每一行是一个示例:
python evaluate.py --INPUT_SAMPLE=/path/to/samples.txt
如果您发现此代码有用,请引用以下论文:
@article{press2017language,
title={Language Generation with Recurrent Generative Adversarial Networks without Pre-training},
author={Press, Ofir and Bar, Amir and Bogin, Ben and Berant, Jonathan and Wolf, Lior},
journal={arXiv preprint arXiv:1706.01399},
year={2017}
}
该存储库是基于在Wasserstein Gans进行了改进的培训中发表的代码。