Código para la capacitación y evaluación del modelo de "Generación de idiomas con redes adversas generativas recurrentes sin pre-entrenamiento".
Un breve resumen del documento está disponible aquí.
" 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 comenzar a entrenar el modelo Cl+VL+TH, primero descargue el conjunto de datos, disponible en http://www.statmt.org/lm-benchmark/, y extraiga al directorio ./data .
Luego use el siguiente comando:
python curriculum_training.py
Se requieren los siguientes paquetes:
Se pueden configurar los siguientes parámetros:
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)
Los parámetros se pueden establecer cambiando su valor en el archivo de configuración o pasándolos en el terminal:
python curriculum_training.py --START_SEQ=1 --END_SEQ=32
El script generate.py generará muestras BATCH_SIZE utilizando un modelo guardado. Debe ejecutarse utilizando los parámetros utilizados para entrenar el modelo (si son diferentes a los valores predeterminados). Por ejemplo:
python generate.py --CKPT_PATH=/path/to/checkpoint/seq-32/ckp --DISC_GRU_LAYERS=2 --GEN_GRU_LAYERS=2
(Si su modelo no ha alcanzado la etapa 32 en el plan de estudios, asegúrese de cambiar el '32' en el camino anterior a la etapa máxima en el plan de estudios en el que su modelo entrenó).
Para evaluar las muestras utilizando nuestras métricas %-in-test-n, use el siguiente comando, vinculado a un archivo txt donde cada fila es una muestra:
python evaluate.py --INPUT_SAMPLE=/path/to/samples.txt
Si encontró este código útil, cite el siguiente documento:
@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 repositorio se basa en el código publicado en la capacitación mejorada de Wasserstein Gans.