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:
$ python
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42
>>>
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-directorymodels/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.
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), 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.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
One day perhaps we can have a framework that suggests strategies, guides, and tunes itself to a degree but that is not yet today. I do not think we will ever get to a point where understanding data is trivial but simple problems should be simple and some of these problems are tomorrow's simple problems.
Perhaps it is a statement on where we are on machine learning. We are to the point where the technology is starting to seep more into mid-size development shops that might have access to a small handful of experts but despite constant statements of an AI first future, machine learning is not yet ubiquitous.
Still, I think it should pose a challenge to many developers out there. Machine learning is becoming more accessible and what once was a graduate level or theoretical topic is having real impact in the industry (you only have to watch build or google's recent presentations to understand this). It will not be long before good machine learning classes become standard in undergraduate programs and in ten years, understanding machine learning may be part of the average developer's job.
The constant challenge to learn new things is part of what makes a great developer. I hope more people challenge themselves to step up and embrace the brand new worlds that are being created all the time. It is really nice to see this on this blog.
No GPU support is a real shame though, since TensorFlow obviously thrives on GPUs.
Do you know whether that'll be part for the final Windows 10 Bash integration?
Next year python.
I am glad there are other alternatives available that are more approachable. Still, I think the hallmark of a great library is that simple things are simple and complex things are possible. I would like to see libraries that allow people to grow with them and make progressively better solutions by investing more time and knowledge.
In the future, this is not going to be advanced data science; it is just going to be normal work.
$ sudo apt-get install python-pip python-dev
I always get:
E: Sub-process /usr/bin/dpkg returned an error code (1)
and it seems related to mounting proc:
the keytool command requires a mounted proc fs (/proc).
Are you saying you used it out of the box and it just works? I'm using a fresh install of 14342.
lxrun /uninstall /full
Then reboot, and run bash again and start with a fresh isntall on 14342 and try that?
I hope it'll come, someday
It will of course place them in direct competition with Nvidia but if it is good enough, it could make some applications a bit more practical.
So I got through the steps to run the program and the validation error is 1.4% at step 1700 currently. But Im a Web developer and have a severe lack of fundamental knowledge, despite continual efforts to mitigate this. 2100, and 1.2%... How can I make this specific example give me the context for starting to work inside this amazing field. Im a student in Boulder, CO hoping to expand my knowledge. (Im also running on a mac but am curious for more of a breakdown on the code and theory). This Is obviously a pretty vague/possibly demanding question, but if anyone out there would like to share some insights Id be very eager to hear them. Step 3000 minibatch loss: 2.937, learning rate: .008574, minibatch error 3.1%, validation error 1.1%....
Greg
I often, if not always, approach development from a point I call "Deployment first", which essentially means I want to figure out how to deploy what I build to the end users before I actually build something.
This is where Ununtu On Windows starts to become confusing for me, as it means I will plan to release on Ubuntu, which I perhaps don't mind, but feels liks a confusing Microsoft scenario.
So I am curious to see where the end game is for Bash On Windows. The MinGW approach is quite appealing, but it means adapting the code for Linux and abstract the OS layer in the code properly. The Cygwin approach is also very appealing for gettings tools on windows, but it requires an active shim to work and this shim has to be machine unique/global. To have Windows map all the syscalls is a very interesting approach, and one that, so far, only Microsoft can properly do, so there is hope we will get the best of these 3 worlds in the future.
At the moment my biggest blocker for using Bash On Windows is that there needs to be a better interaction between the environments, that you can't edit files in normal "Windows" editors and have then reliably update in the Ubuntu world is at the moment my biggest blocker for even using it in a dev flow.
And a compelling deployment story would also be interesting, unless of course the story is mostly, you don't need to run ubuntu to play with the stuff you can stay in Windows.
Or perhaps this is a precursor to Android on Windows.
http://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/
I have TensorFlow r0.9 which I downloaded from this link.
I installed Python 3.4.4 and Docker for windows.
But I'm not able to install TensorFlow. Can you tell me how should I proceed with installation.what are the steps for it. I have Windows 7 (Professional) 64-bit
Thanks
>eapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp2
>/linux/cpu/tensorflow
>/cpu/
What's the point?
Comments are closed.
Without that support it's basically useless for my company as we can't install node version manager (NVM)