Note: This video has subtitles - Click the "CC" button to activate.
RNN on Windows 10: Docker
I created an Azure Container Registry (ACR) to store a Docker container image of Cristian Baldi’s Docker-torch-rnn (which uses Justin Johnson’s “torch-rnn” project, a refactoring of Andrej Karpathy’s “char-rnn.”) An ACR allows for the use of open-source Docker command line interface (CLI) tools, and keeps container images near deployments to reduce latency and costs.
Step 0) Prerequisites
- Docker CLI. To set up your local computer as a Docker host and access the Docker CLI commands, install Docker Engine before starting this workshop. https://docs.docker.com/engine/installation/
- Windows. This workshop contains screenshots from a Windows 10 Enterprise PC with the latest updates.
- Bash on Ubuntu on Windows is the preferred CLI for this workshop. https://www.windowscentral.com/how-install-bash-shell-command-line-windows-10
Step 1) Start Docker
Start Docker by clicking the Whale icon. Bash on Ubuntu on Windows is preferred for typing Docker commands. If your Docker commands don’t work in Bash, try restarting your computer, or using Windows PowerShell.
Note: Make sure the white whale in your task bar is set for using Linux. If you right click it and it says “Switch to Windows containers,” leave it alone; you are good to go.
Docker must be running with "Expose daemon on tcp://localhost:2375 without TLS" enabled. (Right click on the system tray icon then "Settings..."). This is not checked by default, so you must check it.
Step 2) Run Image
Writing “docker -v” as your first command will ensure your Docker commands are working by showing you which version and build of Docker your machine is running.
docker run hello-world
To connect a docker client to Docker for Windows, keep in mind that Docker for Windows runs a Linux Hyper-V VM where it starts the daemon. Try running "docker run hello-world" so that the Docker client connects to the docker daemon. This "export" step is optional:
To pull or run Sarah’s pre-trained Docker snapshot to avoid waiting for hours, type:
docker run -it saelia/rnn-js /bin/bash
Adding ./bin/bash to the end will give you a bash terminal to work in. You shouldn't need to type "docker pull" before you do "docker run" because if the image isn't there, docker will pull the image for you in the "docker run" step.
To show all docker containers - sudo docker ps -a
To start docker container - sudo docker start <container-name>
To attach to docker container - sudo docker attach <container-name>
Step 3) Sample Text
The way to actually make the RNN generate new text is with the data sampling script:
th sample.lua -gpu -1 -checkpoint cv/checkpoint_12900.t7 -length 150 -temperature .7
Figure 1: "The mind the same hath so much but promise the brother." - Catesby, William Fakespeare
GPU: Setting the flag gpu to -1 tells the code to train using CPU; otherwise it defaults to GPU 0.
Length: An important flag is -length. 100 would generate a body of text 100 characters in length. The default is 2000.
Temperature: An important parameter you may want to play with is -temperature, which takes a number in range (0 to 1, 0 not included), default = 1. Lower temperature will cause the model to make more “likely” but more boring and conservative predictions. Higher temperatures cause the model to take more chances and increase diversity of results, but at a cost of more mistakes.
How to turn off Docker: Type “exit”, Close PowerShell. Right click the white whale in your task bar. Sign out / quit Docker.