Código para treinamento e avaliação do modelo a partir de "geração de idiomas com redes adversárias generativas recorrentes sem pré-treinamento".
Um breve resumo do artigo está disponível aqui.
" 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
Para começar a treinar o modelo CL+VL+TH, primeiro faça o download do conjunto de dados, disponível em http://www.statmt.org/lm-benchmark/ e extraia-o para o diretório ./data .
Em seguida, use o seguinte comando:
python curriculum_training.py
Os pacotes a seguir são necessários:
Os seguintes parâmetros podem ser configurados:
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)
Os parâmetros podem ser definidos alterando seu valor no arquivo de configuração ou passando -os no terminal:
python curriculum_training.py --START_SEQ=1 --END_SEQ=32
O script generate.py gerará amostras BATCH_SIZE usando um modelo salvo. Ele deve ser executado usando os parâmetros usados para treinar o modelo (se forem diferentes dos valores padrão). Por exemplo:
python generate.py --CKPT_PATH=/path/to/checkpoint/seq-32/ckp --DISC_GRU_LAYERS=2 --GEN_GRU_LAYERS=2
(Se o seu modelo não atingiu o estágio 32 no currículo, altere o '32' no caminho acima para o estágio máximo do currículo em que seu modelo treinou.)
Para avaliar amostras usando nossas métricas %-in-test-n, use o seguinte comando, vinculando-se a um arquivo txt em que cada linha é uma amostra:
python evaluate.py --INPUT_SAMPLE=/path/to/samples.txt
Se você achou esse código útil, cite o seguinte artigo:
@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}
}
Este repositório é baseado no código publicado no treinamento aprimorado de Wasserstein Gans.