TensorFlow

This is a quick and dirty explanation to get TensorFlow environment working within a Mac running 10.11 (el Capitan). This makes use of a virtual environment which will be provided by docker. From there you install the TensorFlow images into this virtual environment. There really isn't much too it.

Docker

So, to install docker:

Docker has a good instruction page here: https://docs.docker.com/engine/installation/mac/ But essentially:

To start a docker environment, look for "docker Quickstart Terminal" in spotlight. To check that everything is hunky-dory, in this terminal that popped up, type: docker run hello-world. The output should look like:
Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

When starting a new Docker image, one can provide interactive flags (-i). To detach from this shell without it exiting, a Ctrl-d will do the trick (docker info) will tell you how many containers are running. To list all containers (stopped and running) do docker ps -a.

Some more interactive commands can be found here: https://docs.docker.com/engine/quickstart/#running-an-interactive-shell

So Docker is now installed, now for TensorFlow

TensorFlow

Installation of TensorFlow in the Docker environment is incredibly easy. Type docker run -it b.gcr.io/tensorflow/tensorflow:latest-devel from the "docker Quickstart Terminal". On first run, this will download the TensorFlow image, subsequent runs use the same, fresh image. More info and a list of images can be found at https://www.tensorflow.org/versions/r0.7/get_started/os_setup.html. To test if TensorFlow properly installed do python -m tensorflow.models.image.mnist.convolutional. Output should look something like:

Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes.
Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes.
Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes.
Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes.
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
Initialized!
Step 0 (epoch 0.00), 7.4 ms
Minibatch loss: 12.053, learning rate: 0.010000
Minibatch error: 90.6%
Validation error: 84.6%
Step 100 (epoch 0.12), 601.3 ms
...

A nice image recognition example for TensorFlow can be found here: https://www.tensorflow.org/versions/r0.7/tutorials/image_recognition/index.html

More examples/tutorials can be found here: https://www.tensorflow.org/versions/r0.7/tutorials/index.html

-- JoshuaWyattSmith - 2016-04-01

Edit | Attach | Watch | Print version | History: r5 | r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2016-04-01 - JoshuaWyattSmith
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback