Playing with TensorFlow on Windows
TensorFlow is a machine learning library from Google. There are no Windows builds but I wanted to run it on Windows. There are some other blog posts that show people trying to get TensorFlow running on Windows with VMs or Docker (using a VM) but they are a little complex. This seems like a great chance to see of I can just run Bash on Windows 10, build TensorFlow and run it.
I'm running Windows 10 Insiders Build 14422 as of the time of this writing. I launched Bash on Windows and followed these pip (Python) instructions, just as if I was running Linux. Note that the GPU support won't work so I followed the CPU only instructions from my Surface Pro 3.
$ sudo apt-get install python-pip python-dev
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
It built, then I tested it like this:
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
Cool, but this is Hello World. Let's try the more complex example against the MINST Handwriting Models. The simple demo model for classifying handwritten digits from the MNIST dataset is in the sub-directory
models/image/mnist/convolutional.py. You'll need to check when your mnist folder is.
$ cd tensorflow/models/image/mnist
$ python convolutional.py
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.
Step 0 (epoch 0.00), 9.3 ms
Minibatch loss: 12.054, learning rate: 0.010000
Minibatch error: 90.6%
Validation error: 84.6%
Step 100 (epoch 0.12), 826.7 ms
Minibatch loss: 3.289, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 7.0%
This set appears to be working great and is currently on Step 1500
There's bugs in the Bash on Windows 10, of course. It's in Beta. But it's not a toy, and it's gonna be a great addition to my developer toolbox. I like that I was able to follow the Linux instructions exactly and they just worked. I'm looking forward to seeing how hard I can push Ubuntu and Bash on Windows 10.
Sponsor: Big thanks to SQL Prompt for sponsoring the feed this week! Have you got SQL fingers? TrySQL Prompt and you’ll be able to write, refactor, and reformat SQL effortlessly in SSMS and Visual Studio.Find out more.