Installing TensorFlow on Windows 10 with GPU Support

Valuable resources I used to make this install less maddening

Jacob Younan
AI From Scratch
4 min readMay 15, 2017

--

At some point, you’re going to want to poke around and explore what a machine learning model actually looks like. How do you train one? What do frameworks like TensorFlow (TF) actually do? Am I capable of comprehending the absolute simplest version of this?

These questions and more can only be answered if you can figure out how to install it on your machine. I suppose you could just watch others explain it on YouTube and assume you ‘get it’, but let’s assume you’re getting a little more ambitious.

I started exploring TF first, as a recent post by Andrej Karpathy highlighted its rise in popularity based on ML research paper publication data on arXiv (about 40% of community using it):

It also seems to be the most well-known and documented of the frameworks when it comes to online support resources. Below are helpful ones that guided me:

Installing TensorFlow (TF)

When you visit the official site, it says you need these things installed to use your computer’s graphics card for TensorFlow:

  1. A graphics card (GPU) with 3.0+ CUDA Compute Capability score

Do this first, because if it’s not at least 3.0, don’t bother with this install process. You can check here on NVIDIA’s site — yours is likely listed under ‘CUDA-Enabled GeForce Products’. Mine barely made the cut at 3.0.

If yours doesn’t make the cut, you can do the ‘CPU install’ version listed on the TF site (prepare to be underwhelmed by the speed) or use Google’s Cloud Platform, APIs and Datalab as your notebook. I set up an account there and went through their quick start, but figured I should try to use my machine for the super simple tutorials before going any further in the cloud.

2. Python 3.5.x — Download Here

Scroll down and look for the Windows x86 installation for your setup. If your OS is 64-bit (go to System in your Control Panel if you don’t know), select one of the ‘-64’ files that suits your install preference.

3. CUDA Toolkit 8.0Download Here, Handy (but long) Install Guide

4. Associated NVIDIA drivers — My drivers updated during the CUDA install

5. cuDNN 5.1 Download Here (free signup required)

For these next three steps, I found the following walk-through most helpful:

This video should give you everything you need up until about 9:20 when he installs TF using Anaconda. I wasn’t using Anaconda, so I just used the official instructions on the TF website for ‘Installing with native pip’, typing this into the command prompt:

After that, validate your TensorFlow Installation as instructed by Google:

Invoke python from your shell as follows:

Enter the following short program inside the python interactive shell:

Add Jupyter Notebook

I’m absolutely the wrong person to ask about what text editor and/or notebook you should be using for tinkering with TensorFlow, but Jupyter (formerly IPhython) comes widely recommended. It’s a text editor that opens in your browser. You can write live code and comments (with images on other visuals I believe), and it will run blocks of code right in the browser so you can see them output beneath. I did a couple tutorials using it and liked the UX. If not Jupyter, find a place to write and save your code outside the command prompt.

The Training Wheels — Tutorials with MNIST Dataset

Now that you’re in and you’ve gloriously printed Hello, TensorFlow!, the first thing everyone tells you to do is build a model for recognizing the hand-drawn digits of the MNIST dataset. Build is a strong word, copy a model is more like it.

Here are three versions you can follow along with from simple (92% accurate, apparently a laughable score) to a convolutional neural net (99+% accurate).

  1. Official Google TF Tutorial

2. Sentdex’s Multi-Layer Model for MNIST Data Interpretation

3. Google Cloud Next ’17 Tutorial with Martin Görner

This last one was my favorite. It starts with a basic model, gradually changing parts of the model and adding tricks that end up in a CNN that reaches 99% accuracy. The GitHub repo with all the code from each version he presents sits here:

Installing TensorFlow is basically scratching the surface of the surface. But, assuming you get to the end of the last video and are pretty sure you understand how Martin got to the final result, you should feel a lot more comfortable with machine learning.

That’s where I am anyways. Now I’m going to read the piece below as I continue with tutorials. I’ve only skimmed it, so I can’t recommend it…but how bad could it be?

--

--