Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Train your own text generator in this webapp. Training based on LSTM network (Tensorflow in Python), webapp implemented in Node.js

License

Notifications You must be signed in to change notification settings

ivarprudnikov/char-rnn-tensorflow

Repository files navigation

Char-RNN-TensorFlow

Build Status GitHub issues GitHub last commit

Blog post explaining it all Run Tensorflow scripts from Node.js server deployed on AWS as Docker container

Character generator using recurrent neural network (RNN). Also Node.js server used to provide HTTP API for training RNN and then generating samples from saved checkpoints.

Homepage screenshot

Generator

Forked from hzy46/Char-RNN-TensorFlow and is in separate directory (generator/) now to avoid confusion. It has its own documentation in generator/README.md.

Server

Trivial Node.js server used to store incoming training data and call python scripts to train and generate text. Read about it in server/README.md

Development

Both server and generator are expected to run in Docker
and running image locally would replicate production environment. You could also run server directly but then need to be sure that all python dependencies are installed locally.

You will need to have MySQL database running with the schema provided in mysql_setup/

a) Build and run Docker image

Via prepared script

$ ./runDockerImage.sh

Manually

  • To build container image: docker build -t <some_name> .
  • To run above image:
docker run --rm -ti \
    -e "MYSQL_HOST=docker.for.mac.localhost" \
    -e "MYSQL_USER=root" \
    -e "MYSQL_PASSWORD=" \
    -e "MYSQL_DATABASE=rnn_generator" \
    -p 8080:8080 <some_name>

Tip: If you want to keep trained models and uploads between runs then map local volume/directory when starting Docker container:

docker run --rm -ti \
    -v /change/location/models:/app/generator/model \ 
    -v /change/location/uploads:/app/server/uploads \
    -p 8080:8080 <some_name>

b) Run using virtualenv

New virtualenv

  • Create new environment in dir venv - $ virtualenv -p python3 venv
  • Activate environment - $ source venv/bin/activate
  • Install dependencies - (venv) $ pip install -r generator/requirements.txt

Existing virtualenv

  • Activate environment - $ source venv/bin/activate
  • Use Node.js v10 (venv) $ nvm use 10
  • run server (venv) $ node server/server

GPU support

This example does not have Tensorflow with GPU support. If you want to use GPU do one of the following:

FROM tensorflow/tensorflow:1.14.0-gpu-py3

AWS deployment

Deployment to AWS was removed in commit https://github.com/ivarprudnikov/char-rnn-tensorflow/commit/040a93a46e674bb6be71d6cbe1b199142f98d19f

Your feedback

You are free to open issues if there is anything bothering you.

About

Train your own text generator in this webapp. Training based on LSTM network (Tensorflow in Python), webapp implemented in Node.js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published