qmeeus / lstm-text-generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LSTM Text Generator

Inspired from this article

Objective

The objective of this project is to explore techniques for automatic text generation using LSTM recurrent neural networks. The current implementation uses keras but it might move to a pure tensorflow implementation at some point and follow the best practices and structures laid out in this template.

A docker container is provided for the project portability. I might explore possibilities of deployment using Kubeflow as well.

Requirements

  • docker
  • nvidia-drivers and nvidia-docker for GPU support

Data

The model is built on two freely available books from the gutenberg project:

To add your own data, just move the text file to data and specify the name of the file with the extension when training the model. If necessary, add your own configuration in config.py.

Installation

To build the container with CPU support, simply run the following command from a system with docker installed:

docker build -t lstm --build-arg user_id=$(id -u) -f Dockerfile .

Then running the container:

docker run -d --name lstm -v $(pwd):/home/patrick/src/ lstm wonderland.txt

To build the container with GPU support, use the following command from a system with nvidia-docker and nvidia-drivers installed:

nvidia-docker build -t lstm --build-arg user_id=$(id -u) -f Dockerfile.gpu .

Next, run the container with:

nvidia-docker run -d --name lstm -v $(pwd):/home/patrick/src/ lstm wonderland.txt

NB: on Linux systems, make sure that you are part of docker group. If this is not the case, run sudo usermod -aG docker $USER

About

License:MIT License


Languages

Language:Python 89.7%Language:Dockerfile 9.3%Language:Shell 1.0%