Getting Started with Sonnet, Deep Mind’s Deep Learning Library

Intro article to installing Sonnet. Mirroring what is on their github with a little commentary.


Deep Mind released a new library built on top of TensorFlow that abstracts building a network into simpler blocks. Available here: This library was released April 6th and already has 3000 stars on github (checked April 10th).


  1. Install TensorFlow

To do this (I’m on MacOSX with python2.7) If you’re on another setup checkout

pip install --upgrade

2. Install Bazel

Bazel is googles package builder. To install on Mac with homebrew. Anything else checkout

brew install bazel

3. Install Sonnet

Sonnet does not yet support Python3. There is a promising pull request already to set this up. But not as of April 10th 2017.

$ git clone --recursive
$ cd sonnet/tensorflow
$ ./configure
$ cd ../

Configure will ask you some questions about what installation you would like.

Now we will run the install script:

$ mkdir /tmp/sonnet
$ bazel build --config=opt :install
$ ./bazel-bin/install /tmp/sonnet

After that is complete. Took a couple minutes for me:

$ pip install /tmp/sonnet/*.whl

Now to test everything worked 🙂

$ python
>>> import sonnet as snt
>>> import tensorflow as tf
>>> snt.resampler(tf.constant([0.]), tf.constant([0.]))

We should see:

<tf.Tensor 'resampler/Resampler:0' shape=(1,) dtype=float32>

Congratulations you have now setup Deep Mind’s Deep Learning Library on top of TensorFlow

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on Reddit