pablomateo / CharacterWise

AI - RNN trained on Anna Karenina to generate new texts with the same style

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CharacterWise

Udacity - Artificial Intelligence Nanodegree Program
AI - RNN trained on Anna Karenina to generate new texts with the same style

RNN

This project is part of Udacity´s Artificial Intelligence Nanodegree Program. Here you will find my personal solution to the challenge. The following project can be run using a Local Machine or using an external GPU (Solution provided by Amazon Web Services is recommended). Next, you can follow Udacitys instructions to install the necessary dependencies on a local machine or on AWS.

In this project, we train a Recurrent Neural Network on Anna Karenina to generate new texts using the same style.

Follow the instructions to install the required environment and check the jupyter notebook file:

(pmaienv)$ jupyter notebook Anna_KaRNNa.ipynb

Instructions - Udacity Project

  1. Clone the repository and navigate to the downloaded folder.
    $ git clone https://github.com/pablomateo/CharacterWise.git
    $ cd CharacterWise
  1. (Optional) If you plan to install TensorFlow with GPU support on your local machine, follow the guide to install the necessary NVIDIA software on your system. If you are using an EC2 GPU instance, you can skip this step.

  2. (Optional) If you are running the project on your local machine (and not using AWS), create (and activate) a new environment.

    • Linux (to install with GPU support, change requirements/pmaienv-linux.yml to requirements/pmaienv-linux-gpu.yml):
      $ conda env create -f requirements/pmaienv-linux.yml
    $ source activate pmaienv-project
    
    • Mac (to install with GPU support, change requirements/pmaienv-mac.yml to requirements/pmaienv-mac-gpu.yml):
    $ conda env create -f requirements/pmaienv-mac.yml
    $ source activate pmaienv-project
    
    • Windows (to install with GPU support, change requirements/pmaienv-windows.yml to requirements/pmaienv-windows-gpu.yml):
    $ conda env create -f requirements/pmaienv-windows.yml
    $ activate pmaienv-project
    
  3. (Optional) If you are running the project on your local machine (and not using AWS) and Step 6 throws errors, try this alternative step to create your environment.

    • Linux or Mac (to install with GPU support, change requirements/requirements.txt to requirements/requirements-gpu.txt):
    $ conda create --name pmaienv-project python=3.5
    $ source activate pmaienv-project
    (pmaienv)$ pip install -r requirements/requirements.txt
    
    • Windows (to install with GPU support, change requirements/requirements.txt to requirements/requirements-gpu.txt):
    $ conda create --name pmaienv-project python=3.5
    $ activate pmaienv-project
    (pmaienv)$ pip install -r requirements/requirements.txt
    
  4. (Optional) If you are using AWS, install Tensorflow.

    (pmaienv)$ sudo python3 -m pip install -r requirements/requirements-gpu.txt
  1. Switch Keras backend to TensorFlow.

    • Linux or Mac:
    (pmaienv)$ KERAS_BACKEND=tensorflow python -c "from keras import backend"
    
    • Windows:
    (pmaienv)$ set KERAS_BACKEND=tensorflow
    	python -c "from keras import backend"
    
  2. (Optional) If you are running the project on your local machine (and not using AWS), create an IPython kernel for the pmaienv-project environment.

    (pmaienv)$ python -m ipykernel install --user --name pmaienv-project --display-name "pmaienv-project"
  1. Launch Jupyter notebook.
    (pmaienv)$ jupyter notebook Anna_KaRNNa.ipynb
  1. (Optional) If you are running the project on your local machine (and not using AWS), before running code, change the kernel to match the pmaienv-project environment by using the drop-down menu (Kernel > Change kernel > pmaienv-project).

About

AI - RNN trained on Anna Karenina to generate new texts with the same style

License:MIT License


Languages

Language:Jupyter Notebook 100.0%