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-Test-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の改善されたトレーニングで公開されたコードに基づいています。