From d769a3fd306ad5be8e4a118b39394606e360101d Mon Sep 17 00:00:00 2001 From: Manjunath Kudlur Date: Sun, 8 Nov 2015 19:23:41 -0800 Subject: [PATCH] TensorFlow: Upstream changes to git. Changes: - Updates to installation instructions. Base CL: 107352130 --- README.md | 46 ++--- tensorflow/g3doc/get_started/os_setup.md | 185 +++++++++++-------- tensorflow/g3doc/how_tos/index.md | 22 +-- tensorflow/g3doc/navbar.md | 11 ++ tensorflow/g3doc/resources/dims_types.md | 3 +- tensorflow/g3doc/resources/index.md | 2 +- tensorflow/g3doc/tutorials/index.md | 26 +-- tensorflow/g3doc/tutorials/word2vec/index.md | 2 +- 8 files changed, 167 insertions(+), 130 deletions(-) create mode 100644 tensorflow/g3doc/navbar.md diff --git a/README.md b/README.md index 575a305bc4b..e9fc94c6ecf 100644 --- a/README.md +++ b/README.md @@ -24,45 +24,34 @@ and discussion.** # Download and Setup -To install TensorFlow using a binary package, see the instructions below. For -more detailed installation instructions, including installing from source, see +To install the CPU version of TensorFlow using a binary package, see the +instructions below. For more detailed installation instructions, including +installing from source, GPU-enabled support, etc., see [here](tensorflow/g3doc/get_started/os_setup.md). ## Binary Installation +The TensorFlow Python API requires Python 2.7. + +The simplest way to install TensorFlow is using +[pip](https://pypi.python.org/pypi/pip) for both Linux and Mac. + +For the GPU-enabled version, or if you encounter installation errors, or for +more detailed installation instructions, see +[here](tensorflow/g3doc/get_started/os_setup.md#detailed_install). + ### Ubuntu/Linux -Make sure you have [pip](https://pypi.python.org/pypi/pip) installed: - -```sh -$ sudo apt-get install python-pip -``` - -Install TensorFlow: - -```sh +```bash # For CPU-only version -$ sudo pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl - -# For GPU-enabled version. See detailed install instructions -# for GPU configuration information. -$ sudo pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl +$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl ``` ### Mac OS X -Make sure you have [pip](https://pypi.python.org/pypi/pip) installed: - -If using `easy_install`: - -```sh -$ sudo easy_install pip -``` - -Install TensorFlow (only CPU binary version is currently available). - -```sh -$ sudo pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl +```bash +# Only CPU-version is available at the moment. +$ pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl ``` ### Try your first TensorFlow program @@ -83,7 +72,6 @@ Hello, TensorFlow! ``` - ##For more information * [TensorFlow website](http://tensorflow.org) diff --git a/tensorflow/g3doc/get_started/os_setup.md b/tensorflow/g3doc/get_started/os_setup.md index 39ed8705565..ab64a2a18d9 100644 --- a/tensorflow/g3doc/get_started/os_setup.md +++ b/tensorflow/g3doc/get_started/os_setup.md @@ -1,90 +1,33 @@ # Download and Setup +You can install TensorFlow using our provided binary packages or from source. + ## Binary Installation The TensorFlow Python API requires Python 2.7. +The simplest way to install TensorFlow is using +[pip](https://pypi.python.org/pypi/pip) for both Linux and Mac. + +If you encounter installation errors, see [common problems](#common_problems) +for some solutions. To simplify installation, please consider using our +virtualenv-based instructions [here](#virtualenv_install). + ### Ubuntu/Linux -**Note**: All the virtualenv-related instructions are optional, but we recommend -using the virtualenv on any multi-user system. - -Make sure you have [pip](https://pypi.python.org/pypi/pip), the python headers, -and (optionally) [virtualenv](https://pypi.python.org/pypi/virtualenv) installed: - -```bash -$ sudo apt-get install python-pip python-dev python-virtualenv -``` - -Set up a new virtualenv environment. To set it up in the -directory `~/tensorflow`, run: - -```bash -$ virtualenv --system-site-packages ~/tensorflow -$ cd ~/tensorflow -``` - -Activate the virtualenv: - -```bash -$ source bin/activate # If using bash -$ source bin/activate.csh # If using csh -(tensorflow)$ # Your prompt should change -``` - -Inside the virtualenv, install TensorFlow: - ```bash # For CPU-only version -(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl +$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl # For GPU-enabled version (only install this version if you have the CUDA sdk installed) -(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl - -# When you are done using TensorFlow: -(tensorflow)$ deactivate # Deactivate the virtualenv -$ # Your prompt should change back +$ pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl ``` ### Mac OS X -**Note**: All the virtualenv-related instructions are optional, but we recommend -using the virtualenv on any multi-user system. - -Make sure you have [pip](https://pypi.python.org/pypi/pip) and -(optionally) [virtualenv](https://pypi.python.org/pypi/virtualenv) installed: - -If using `easy_install`: - ```bash -$ sudo easy_install pip # If pip is not already installed -$ sudo pip install --upgrade virtualenv -``` - -Set up a new virtualenv environment. Assuming you want to set it up in the -directory `~/tensorflow`, run: - -```bash -$ virtualenv --system-site-packages ~/tensorflow -$ cd ~/tensorflow -``` - -Activate the virtualenv: - -```bash -$ source bin/activate # If using bash -$ source bin/activate.csh # If using csh -(tensorflow)$ # Your prompt should change -``` - -Install TensorFlow (only CPU binary version is currently available). - -```bash -(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl - -# When you are done using TensorFlow: -(tensorflow)$ deactivate # Deactivate the virtualenv -$ # Your prompt should change back +# Only CPU-version is available at the moment. +$ pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl ``` ## Docker-based installation @@ -132,11 +75,10 @@ export CUDA_HOME=/usr/local/cuda ### Run TensorFlow -First, activate the TensorFlow virtualenv, then open a python terminal: +Open a python terminal: ```bash -$ source ~/tensorflow/bin/activate # Assuming the tensorflow virtualenv is ~/tensorflow -(tensorflow)$ python +$ python >>> import tensorflow as tf >>> hello = tf.constant('Hello, TensorFlow!') @@ -332,3 +274,100 @@ Validation error: 7.0% ... ... ``` + +## VirtualEnv-based installation + +We recommend using [virtualenv](https://pypi.python.org/pypi/virtualenv) to +create an isolated container and install TensorFlow in that container -- it is +optional but makes verifying installation issues easier. + +First, install all required tools: + +```bash +# On Linux: +$ sudo apt-get install python-pip python-dev python-virtualenv + +# On Mac: +$ sudo easy_install pip # If pip is not already installed +$ sudo pip install --upgrade virtualenv +``` + +Next, set up a new virtualenv environment. To set it up in the +directory `~/tensorflow`, run: + +```bash +$ virtualenv --system-site-packages ~/tensorflow +$ cd ~/tensorflow +``` + +Then activate the virtualenv: + +```bash +$ source bin/activate # If using bash +$ source bin/activate.csh # If using csh +(tensorflow)$ # Your prompt should change +``` + +Inside the virtualenv, install TensorFlow: + +```bash +(tensorflow)$ pip install --upgrade <$url_to_binary.whl> +``` + +You can then run your TensorFlow program like: + +```bash +(tensorflow)$ python tensorflow/models/image/mnist/convolutional.py + +# When you are done using TensorFlow: +(tensorflow)$ deactivate # Deactivate the virtualenv + +$ # Your prompt should change back +``` + + +## Common Problems + +### GPU-related issues + +If you encounter the following when trying to run a TensorFlow program: + +```python +ImportError: libcudart.so.7.0: cannot open shared object file: No such file or directory +``` + +Make sure you followed the the GPU installation [instructions](#install_cuda). + +### On Linux + +If you encounter: + +```python +... + "__add__", "__radd__", + ^ +SyntaxError: invalid syntax +``` + +Solution: make sure you are using Python 2.7. + +### On MacOSX + + +If you encounter: + +```python + import six.moves.copyreg as copyreg + +ImportError: No module named copyreg +``` + +Solution: TensorFlow depends on protobuf which require six-1.10.0. The +installation on some machines may only have an earlier version of six that was +installed using distutils. Unfortunately, upgrading a distutils installed +project via `pip` is deprecated and may fail. If you having difficulty +upgrading six, we recommend playing around with tensorflow using virtualenv. + + + + diff --git a/tensorflow/g3doc/how_tos/index.md b/tensorflow/g3doc/how_tos/index.md index 7b4b1605ffb..c63a4e19b81 100644 --- a/tensorflow/g3doc/how_tos/index.md +++ b/tensorflow/g3doc/how_tos/index.md @@ -1,7 +1,7 @@ -# Overview +# Overview -## Variables: Creation, Initializing, Saving, and Restoring +## Variables: Creation, Initializing, Saving, and Restoring TensorFlow Variables are in-memory buffers containing tensors. Learn how to use them to hold and update model parameters during training. @@ -9,7 +9,7 @@ use them to hold and update model parameters during training. [View Tutorial](../how_tos/variables/index.md) -## TensorFlow Mechanics 101 +## TensorFlow Mechanics 101 A step-by-step walk through of the details of using TensorFlow infrastructure to train models at scale, using MNIST handwritten digit recognition as a toy @@ -18,7 +18,7 @@ example. [View Tutorial](../tutorials/mnist/tf/index.md) -## TensorBoard: Visualizing Learning +## TensorBoard: Visualizing Learning TensorBoard is a useful tool for visualizing the training and evaluation of your model(s). This tutorial describes how to build and run TensorBoard as well @@ -28,7 +28,7 @@ TensorBoard uses for display. [View Tutorial](../how_tos/summaries_and_tensorboard/index.md) -## TensorBoard: Graph Visualization +## TensorBoard: Graph Visualization This tutorial describes how to use the graph visualizer in TensorBoard to help you understand the dataflow graph and debug it. @@ -36,7 +36,7 @@ you understand the dataflow graph and debug it. [View Tutorial](../how_tos/graph_viz/index.md) -## Reading Data +## Reading Data This tutorial describes the three main methods of getting data into your TensorFlow program: Feeding, Reading and Preloading. @@ -44,7 +44,7 @@ TensorFlow program: Feeding, Reading and Preloading. [View Tutorial](../how_tos/reading_data/index.md) -## Threading and Queues +## Threading and Queues This tutorial describes the various constructs implemented by TensorFlow to facilitate asynchronous and concurrent training. @@ -52,7 +52,7 @@ to facilitate asynchronous and concurrent training. [View Tutorial](../how_tos/threading_and_queues/index.md) -## Adding a New Op +## Adding a New Op TensorFlow already has a large suite of node operations from which you can compose in your graph, but here are the details of how to add you own custom Op. @@ -60,7 +60,7 @@ compose in your graph, but here are the details of how to add you own custom Op. [View Tutorial](../how_tos/adding_an_op/index.md) -## Custom Data Readers +## Custom Data Readers If you have a sizable custom data set, you may want to consider extending TensorFlow to read your data directly in it's native format. Here's how. @@ -68,14 +68,14 @@ TensorFlow to read your data directly in it's native format. Here's how. [View Tutorial](../how_tos/new_data_formats/index.md) -## Using GPUs +## Using GPUs This tutorial describes how to construct and execute models on GPU(s). [View Tutorial](../how_tos/using_gpu/index.md) -## Sharing Variables +## Sharing Variables When deploying large models on multiple GPUs, or when unrolling complex LSTMs or RNNs, it is often necessary to access the same Variable objects from diff --git a/tensorflow/g3doc/navbar.md b/tensorflow/g3doc/navbar.md new file mode 100644 index 00000000000..1512af066bf --- /dev/null +++ b/tensorflow/g3doc/navbar.md @@ -0,0 +1,11 @@ +# TensorFlow + +* [Home][home] +* [Getting Started](/get_started/index.md) +* [Mechanics](/how_tos/index.md) +* [Tutorials](/tutorials/index.md) +* [Python API](/api_docs/python/index.md) +* [C++ API](/api_docs/cc/index.md) +* [Other Resources](/resources/index.md) + +[home]: /index.md diff --git a/tensorflow/g3doc/resources/dims_types.md b/tensorflow/g3doc/resources/dims_types.md index 928dfb2b8ec..aaef05960c1 100644 --- a/tensorflow/g3doc/resources/dims_types.md +++ b/tensorflow/g3doc/resources/dims_types.md @@ -15,7 +15,7 @@ Python list) has a rank of 2: t = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] -A rank two tensor is what we typically think of as a matrix, a rank on tensor +A rank two tensor is what we typically think of as a matrix, a rank one tensor is a vector. For a rank two tensor you can acccess any element with the syntax `t[i, j]`. For a rank three tensor you would need to address an element with 't[i, j, k]'. @@ -65,4 +65,3 @@ Data type | Python type | Description `DT_QINT32` | `tf.qint32` | 32 bits signed integer used in quantized Ops. `DT_QINT8` | `tf.qint8` | 8 bits signed integer used in quantized Ops. `DT_QUINT8` | `tf.quint8` | 8 bits unsigned integer used in quantized Ops. - diff --git a/tensorflow/g3doc/resources/index.md b/tensorflow/g3doc/resources/index.md index 415c440d505..c099c8a7895 100644 --- a/tensorflow/g3doc/resources/index.md +++ b/tensorflow/g3doc/resources/index.md @@ -6,7 +6,7 @@ Additional details about the TensorFlow programming model and the underlying implementation can be found in out white paper: -* [TensorFlow: Large-scale machine learning on heterogeneous systems](http://tensorflow.org/tensorflow-whitepaper2015.pdf) +* [TensorFlow: Large-scale machine learning on heterogeneous systems](http://www.tensorflow.org/whitepaper2015.pdf) ### Citation diff --git a/tensorflow/g3doc/tutorials/index.md b/tensorflow/g3doc/tutorials/index.md index 65d9281d6ac..84215c72f1d 100644 --- a/tensorflow/g3doc/tutorials/index.md +++ b/tensorflow/g3doc/tutorials/index.md @@ -1,7 +1,7 @@ -# Overview +# Overview -## MNIST For ML Beginners +## MNIST For ML Beginners If you're new to machine learning, we recommend starting here. You'll learn about a classic problem, handwritten digit classification (MNIST), and get a @@ -10,7 +10,7 @@ gentle introduction to multiclass classification. [View Tutorial](../tutorials/mnist/beginners/index.md) -## Deep MNIST for Experts +## Deep MNIST for Experts If you're already familiar with other deep learning software packages, and are already familiar with MNIST, this tutorial with give you a very brief primer on @@ -19,7 +19,7 @@ TensorFlow. [View Tutorial](../tutorials/mnist/pros/index.md) -## TensorFlow Mechanics 101 +## TensorFlow Mechanics 101 This is a technical tutorial, where we walk you through the details of using TensorFlow infrastructure to train models at scale. We use again MNIST as the @@ -28,7 +28,7 @@ example. [View Tutorial](../tutorials/mnist/tf/index.md) -## Convolutional Neural Networks +## Convolutional Neural Networks An introduction to convolutional neural networks using the CIFAR-10 data set. Convolutional neural nets are particularly tailored to images, since they @@ -38,7 +38,7 @@ representations of visual content. [View Tutorial](../tutorials/deep_cnn/index.md) -## Vector Representations of Words +## Vector Representations of Words This tutorial motivates why it is useful to learn to represent words as vectors (called *word embeddings*). It introduces the word2vec model as an efficient @@ -49,7 +49,7 @@ embeddings). [View Tutorial](../tutorials/word2vec/index.md) -## Recurrent Neural Networks +## Recurrent Neural Networks An introduction to RNNs, wherein we train an LSTM network to predict the next word in an English sentence. (A task sometimes called language modeling.) @@ -57,7 +57,7 @@ word in an English sentence. (A task sometimes called language modeling.) [View Tutorial](../tutorials/recurrent/index.md) -## Sequence-to-Sequence Models +## Sequence-to-Sequence Models A follow on to the RNN tutorial, where we assemble a sequence-to-sequence model for machine translation. You will learn to build your own English-to-French @@ -66,7 +66,7 @@ translator, entirely machine learned, end-to-end. [View Tutorial](../tutorials/seq2seq/index.md) -## Mandelbrot Set +## Mandelbrot Set TensorFlow can be used for computation that has nothing to do with machine learning. Here's a naive implementation of Mandelbrot set visualization. @@ -74,7 +74,7 @@ learning. Here's a naive implementation of Mandelbrot set visualization. [View Tutorial](../tutorials/mandelbrot/index.md) -## Partial Differential Equations +## Partial Differential Equations As another example of non-machine learning computation, we offer an example of a naive PDE simulation of raindrops landing on a pond. @@ -82,7 +82,7 @@ a naive PDE simulation of raindrops landing on a pond. [View Tutorial](../tutorials/pdes/index.md) -## MNIST Data Download +## MNIST Data Download Details about downloading the MNIST handwritten digits data set. Exciting stuff. @@ -90,7 +90,7 @@ stuff. [View Tutorial](../tutorials/mnist/download/index.md) -## Visual Object Recognition +## Visual Object Recognition We will be releasing our state-of-the-art Inception object recognition model, complete and already trained. @@ -98,7 +98,7 @@ complete and already trained. COMING SOON -## Deep Dream Visual Hallucinations +## Deep Dream Visual Hallucinations Building on the Inception recognition model, we will release a TensorFlow version of the [Deep Dream](https://github.com/google/deepdream) neural network diff --git a/tensorflow/g3doc/tutorials/word2vec/index.md b/tensorflow/g3doc/tutorials/word2vec/index.md index 4ebae23f631..dcf5d24c2b1 100644 --- a/tensorflow/g3doc/tutorials/word2vec/index.md +++ b/tensorflow/g3doc/tutorials/word2vec/index.md @@ -106,7 +106,7 @@ P(w_t | h) &= \text{softmax}(\exp \{ \text{score}(w_t, h) \}) \\ \end{align} $$ -where \\(\text{score}(w_t, h)\\) computes the compatibility of word \\(w_t\\) with +where \\( \text{score}(w_t, h) \\) computes the compatibility of word \\(w_t\\) with the context \\(h\\) (a dot product is commonly used). We train this model by maximizing its log-likelihood on the training set, i.e. by maximizing