How to set up a learning environment for the Udacity Deep Learning class using TensorFlow (Windows)

I believe that many of those interested in learning DL have heard of this course:

https://www.udacity.com/course/deep-learning--ud730

Now I'm taking a course and want to share step-by-step instructions on how to set up the learning environment on Windows from scratch.

  • The first answer, titled “ENVIRONMENTAL SETTING”, is setting up the learning environment. You run it only once.

  • The second answer, named AFTER THE LOCAL REBOOT MACHINE, is about how to start the environment after the computer restarts.

  • See the third answer “HOW IT IS ALL WORKS” to find out how all this works (or you can follow the first answer blindly and check it later).

+9
source share
4 answers

ENVIRONMENTAL CONFIGURATION (run it only once!)

NB To start ready-made environments after restarting the computer, use the AFTER LOCAL REBOOT MACHINE command in the second answer.


Steps:

  • Download and configure the Docker Toolbox:

https://www.docker.com/products/docker-toolbox

Docker is a tool for deploying a pre-installed virtual learning environment on your computer. It will work inside the virtual machine and in any case will not interact with your computer.

  1. (optional step) Docker will put it on the system drive (C :) and you can change it if you use an SSD. You can do it as follows:

mklink / J "C: \ Users \ USER \ .docker" "D: \ Docker"

  • replace USER with your username
  • replace "D: \ Docker" with the path on another drive where you want to save the Docker files.

Read more in: Change the .docker directory on Windows

  1. Open Windows CMD. Go to the folder where Docker is installed. Create a new docker machine:

docker-machine create virtual box vdocker -d

  1. (magic step) Just run it!

FOR / f "tokens = *"% i IN ('docker-machine env -shell cmd vdocker') DO% i

Read more in: How to get started with jupyter docker for docker for tensons

  1. Download and install the pre-configured docker docker image:

docker run -it -p 8888: 8888 -p 6006: 6006 --name tensorflow-udacity -it b.gcr.io/tensorflow-udacity/assignmentscript.5.0

  1. (important step!) Configuring port forwarding:
    • Launch Oracle VM VirtualBox link (must be created when installing Docker):

enter image description here

  • Go to Settings ... of the vdocker device:

enter image description here

  • Add port forwarding (it redirects port 8888 into the virtual environment to port 8810 on your local machine):

enter image description here

PS . Usage: port 8810, if you already have an IPython laptop installed on your local machine.

  1. In the Settings menu (from the previous step), allow the virtual machine more memory:

NB Before making any changes to the system settings, you must disable VirtualBox. (by jlarsch)

Use the following command to stop the virtual machine:

docker-machine stop vdocker

enter image description here

(optional) You can also let it use more cores to speed things up:

enter image description here

  1. Profit!

enter image description here

+5
source

AFTER LOCAL REBOOT MACHINE

To start the learning environment after restarting the computer, create a .bat file (I will call it udacity-tf-start.bat) with the following contents:

call docker-machine start vdocker FOR /f "tokens=*" %%i IN ('docker-machine env --shell cmd vdocker') DO %%i call docker start -ai tensorflow-udacity 

Important! %% is a kind of escaping, and you only need it in the BAT file. If you use the same set of commands through the command line, you should use:

 FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd vdocker') DO %i 
+1
source

In addition to the other answers, here is my launch script to create / launch / launch a docker machine. The installation process now comes down to installing the latest version of the docker toolbar (this should automatically install vbox) from https://docs.docker.com/toolbox/toolbox_install_windows/ and run the script:

 @echo off set DOCKERMACHINENAME=tensorflow-udacity set REPOSITORY=gcr.io/tensorflow/udacity-assignments:0.6.0 set "LOCALDIR0=/%SystemDrive:~0,1%/" call :LoCase LOCALDIR0 SET "LOCALDIR=%LOCALDIR0%Users/%USERNAME%" docker-machine.exe env %DOCKERMACHINENAME% > nul 2> nul if "%errorlevel%"=="0" goto m_exists ::Machine has to be created docker-machine create -d virtualbox --virtualbox-memory 8196 %DOCKERMACHINENAME% :m_exists ::Check if machine needs to be restarted docker-machine ip %DOCKERMACHINENAME% > nul 2>nul if not "%errorlevel%"=="0" (docker-machine.exe restart %DOCKERMACHINENAME%) FOR /F "tokens=*" %%i IN ('docker-machine env --shell cmd %DOCKERMACHINENAME%') DO %%i FOR /F "tokens=*" %%F IN ('docker-machine ip %DOCKERMACHINENAME%') DO (SET DOCKERMACHINEIP=%%F) echo Access to iPython: %DOCKERMACHINEIP%:8888 docker inspect %DOCKERMACHINENAME% > nul 2> nul if "%errorlevel%"=="0" goto m_started :: Machine has to be started docker run -p 8888:8888 --name %DOCKERMACHINENAME% -v %LOCALDIR%:/mnt/hosttmp:rw -it %REPOSITORY% goto finished :m_started docker start -ai %DOCKERMACHINENAME% goto finished :LoCase FOR %%i IN ("A=a" "B=b" "C=c" "D=d" "E=e" "F=f" "G=g" "H=h" "I=i" "J=j" "K=k" "L=l" "M=m" "N=n" "O=o" "P=p" "Q=q" "R=r" "S=s" "T=t" "U=u" "V=v" "W=w" "X=x" "Y=y" "Z=z") DO CALL SET "%1=%%%1:%%~i%%" :finished ::hint: to remove container use: docker rm %DOCKERMACHINENAME% 
+1
source

HOW IT IS ALL WORKS

Disclaimer: This may somewhat resemble the plot of Christopher Nolan's film.

Overall picture

enter image description here

More details

Due to some limitations of the operating system, Windows Docker could not be launched there (yet). This is why we first create a virtual box:

docker-machine create vdocker -d virtual box

The next step (designated as the magic step) sets some environment variables for the docker command in order to be able to connect to the docker daemon running inside the virtual window :

FOR / f "tokens = *"% i IN ('docker-machine env --shell cmd vdocker ) DO% i

 >SET DOCKER_TLS_VERIFY=1 >SET DOCKER_HOST=tcp://192.168.99.100:2376 >SET DOCKER_CERT_PATH=C:\Users\USER\.docker\machine\machines\vdocker >SET DOCKER_MACHINE_NAME=vdocker 

Then we run:

docker run -it -p 8888: 8888 -p 6006: 6006 --name tensorflow-udacity -it b.gcr.io/tensorflow-udacity/assignmentscript.5.0

which creates a docker container named tensorflow-udacity from the image that it loads from the specified URL. Important! This container runs inside the virtual window.

Note the -p flags:

-p 8888: 8888-p 6006: 6006

it tells the docker daemon to forward (publish) the container port 8888 to the host (virtual box) port 8888. It is not yet available on a Windows machine!

Now add another port forwarding rule to the virtual box settings:

enter image description here

0
source

All Articles