Sonnet: TensorFlow-based neural network library

Jan. 22, 2018, 11:43 a.m. By: Kirti Bakshi


Google's Deep Mind continues to be active towards its contributions to the artificial intelligence(AI) and deep learning(DL) developer communities. In the months that have passed by recently, the subsidiary of Google has been regular in open sourcing some of the AI and DL tools and frameworks used in some of their high profile solutions. And talking about Sonnet, it is the latest addition to the stack of DeepMind’s open source.

Sonnet: The open-sourced library

Sonnet, the open-sourced object-oriented neural network library has been designed specifically to work with TensorFlow, and as such, the working does not prevent the user from accessing the details that are underlying such as variable_scopes and Tensors. Models that have been written in Sonnet can be freely mixed with raw TF code, and that in other high level libraries hence, Sonnet doesn’t replace TensorFlow, and is therefore simply a higher-level library that meshes well with DeepMind’s internal best-practices when it comes to research.

Moving onto its principle, The main principle of the object-oriented neural network library is to first construct Python objects which represent a part of a neural network and then connect these objects separately into the TensorFlow computation graph.

At a higher level, Sonnet provides a programming model for the implementation of neural networks making the use of TensorFlow. More specifically, Sonnet, as already mentioned before, enables the creation of Python objects that represent components of a neural network which later can then be assembled as part of a TensorFlow graph.

Installation of the library:

  • Sonnet can be installed from pip, with or without the support of GPU.

  • The installation of this library is compatible with Linux/Mac OS X and Python 2.7 and 3.{4,5,6}.

  • The version of TensorFlow installed must be at least 1.2.

  • Installation of Sonnet supports the native pip install as well as the virtualenv installation mode of TensorFlow.

  • Sonnet will work with both the CPU and GPU version of tensorflow, but to allow for that it does not list Tensorflow as a requirement, so a user first needs to install Tensorflow separately if it already hasn't been done so.

Sonnet: Its benefits:

Modules come to be known as a core concept of Sonnet. Conceptually, Within the modules of Sonnet, there are encapsulated elements of a neural network such as models which can be combined multiple times into a data flow graph. That process results in the abstraction of low-level aspects of TensorFlow applications such as variable sharing or session building.

Modules can be combined making the use of arbitrarily complex models and Sonnet, helps enable developers to build their own Modules with the use of a simple programming model. one of the most certainly tangible advantages of Sonnet come to be known as the higher level programming constructs and the module-based configuration as well as connection separation. However, it can be said that some of the biggest benefits of the new DL framework might be hidden beneath the surface. Here are some of the highlighted benefits that are related to Sonnet are:

  • Multi-Neural Network Applications: Implementation of multi-neural network solutions such as multi-layer neural networks or adversarial neural networks in TensorFlow is something short of a nightmare. Sonnet’s Module programming model can help to implement individual neural networks that can be combined to implement higher level networks.

  • Training of Neural Network: Sonnet by focusing on individual modules results in the simplification of the training of neural networks.

  •  Testing: Sonnet’s higher level programming model simplifies the automated testing of neural networks using mainstream frameworks.

  • Extensibility: Developers can control the construction of the TensorFlow graph related to their own module and also easily extend Sonnet by implementing their own modules as well.

  •  Composability: Sonnet is certainly a step forward in that direction where one can Imagine having access to an ecosystem of built and trained neural network modules that can be dynamically composed into higher level networks.

If DeepMind turns out to be successful with Sonnet, it can be thought that we might get to see an explosion on the number of modules as well as frameworks that are similar and that using TensorFlow as the underlying runtime abstract the implementation of different types neural networks.

For more Information: GitHub