Skip to content

dagingehelgoy/Master

Repository files navigation

An Continuous Approach to Text Generation using Generative Adversarial Networks

The project is the final delivery of the Master of Science (MSc) degree in Computer Science at the Department of Computer Science (IDI) at the Norwegian University of Science and Technology (NTNU).

Abstract

Challenges with training GANs to produce discrete tokens has seen significant work in the past year. Generating text can be very useful for tasks such as dialog systems and image captioning. Applying deep generative models to text generation has seen limited success when compared to the visual domain and comes with the challenge of passing the gradient, while keeping the network differentiable. The known effective models that generate text with GAN extend the original framework proposed by Goodfellow using the REINFORCE loss function. We propose a novel approach that requires no modification to the training process proposed by Goodfellow and is able to produce meaningful text without any pre-training. One of the main problems with evaluating results produced by GANs is that there is no corresponding real data for each generated sample. To deal with this problem, we have developed an automatic evaluation method for text generative systems. This method combines the machine learning evaluation metric, BLEU, with a set of interchangeable information retrieval techniques. This allows us to evaluate the semantic quality of our models, as well as comparing them to a baseline.

Results

The following are example sentences produced by our word embedding model.

Flickr30k

<sos>a newspaper is on a trees with the woods <eos> <pad>
<sos>a man in his blue frisbee in the<eos> <pad> <pad>
<sos>two men on a green on the bar <eos> <pad> <pad>
<sos>a man of people are in the background log <eos> <pad>
<sos>two men are holding on the room on the bar <eos>
<sos>people are with a room and on the bar <eos> <pad>
<sos>two men dancing in in the background <eos> <pad> <pad> <pad>
<sos>people walking with leaps is hill <eos> <pad> <pad> <pad> <pad>
<sos>a man wearing white are on the background <eos> <pad> <pad>
<sos>a dog is playing at a <eos> <pad> <pad> <pad> <pad>

Oxford-102 Flower

<sos>a flower with long and thick petals that are pink <eos>
<sos>the petals are delicate and red pedals that are pink <eos>
<sos>the petals on this flower are purple with red stamen <eos>
<sos>this flower has petals that are pink with filament <eos> <pad>
<sos>this flower has petals that are pink with white stamen <eos>
<sos>this flower has petals that are purple with red stamen <eos>
<sos>this flower has petals that are purple with red stamen <eos>
<sos>this flower has petals that are white and folded together <eos>
<sos>this pink flower has flower flat and large white petals <eos>
<sos>this pink flower has flower flat and large white petals <eos>

Baseline Model

SeqGAN

Usage

To configure GAN, edit GAN/config.py

To start training a new model:
python main.py --code gan

To infer new sentences:
python main.py --code gan --inference