Coder Social home page Coder Social logo

google-deepmind / sonnet Goto Github PK

View Code? Open in Web Editor NEW
9.7K 421.0 1.3K 16.44 MB

TensorFlow-based neural network library

Home Page: https://sonnet.dev/

License: Apache License 2.0

Python 95.93% Shell 0.22% Starlark 3.85%
machine-learning artificial-intelligence neural-networks deep-learning tensorflow

sonnet's Introduction

Sonnet

Sonnet

Documentation | Examples

Sonnet is a library built on top of TensorFlow 2 designed to provide simple, composable abstractions for machine learning research.

Introduction

Sonnet has been designed and built by researchers at DeepMind. It can be used to construct neural networks for many different purposes (un/supervised learning, reinforcement learning, ...). We find it is a successful abstraction for our organization, you might too!

More specifically, Sonnet provides a simple but powerful programming model centered around a single concept: snt.Module. Modules can hold references to parameters, other modules and methods that apply some function on the user input. Sonnet ships with many predefined modules (e.g. snt.Linear, snt.Conv2D, snt.BatchNorm) and some predefined networks of modules (e.g. snt.nets.MLP) but users are also encouraged to build their own modules.

Unlike many frameworks Sonnet is extremely unopinionated about how you will use your modules. Modules are designed to be self contained and entirely decoupled from one another. Sonnet does not ship with a training framework and users are encouraged to build their own or adopt those built by others.

Sonnet is also designed to be simple to understand, our code is (hopefully!) clear and focussed. Where we have picked defaults (e.g. defaults for initial parameter values) we try to point out why.

Getting Started

Examples

The easiest way to try Sonnet is to use Google Colab which offers a free Python notebook attached to a GPU or TPU.

Installation

To get started install TensorFlow 2.0 and Sonnet 2:

$ pip install tensorflow tensorflow-probability
$ pip install dm-sonnet

You can run the following to verify things installed correctly:

import tensorflow as tf
import sonnet as snt

print("TensorFlow version {}".format(tf.__version__))
print("Sonnet version {}".format(snt.__version__))

Using existing modules

Sonnet ships with a number of built in modules that you can trivially use. For example to define an MLP we can use the snt.Sequential module to call a sequence of modules, passing the output of a given module as the input for the next module. We can use snt.Linear and tf.nn.relu to actually define our computation:

mlp = snt.Sequential([
    snt.Linear(1024),
    tf.nn.relu,
    snt.Linear(10),
])

To use our module we need to "call" it. The Sequential module (and most modules) define a __call__ method that means you can call them by name:

logits = mlp(tf.random.normal([batch_size, input_size]))

It is also very common to request all the parameters for your module. Most modules in Sonnet create their parameters the first time they are called with some input (since in most cases the shape of the parameters is a function of the input). Sonnet modules provide two properties for accessing parameters.

The variables property returns all tf.Variables that are referenced by the given module:

all_variables = mlp.variables

It is worth noting that tf.Variables are not just used for parameters of your model. For example they are used to hold state in metrics used in snt.BatchNorm. In most cases users retrieve the module variables to pass them to an optimizer to be updated. In this case non-trainable variables should typically not be in that list as they are updated via a different mechanism. TensorFlow has a built in mechanism to mark variables as "trainable" (parameters of your model) vs. non-trainable (other variables). Sonnet provides a mechanism to gather all trainable variables from your module which is probably what you want to pass to an optimizer:

model_parameters = mlp.trainable_variables

Building your own module

Sonnet strongly encourages users to subclass snt.Module to define their own modules. Let's start by creating a simple Linear layer called MyLinear:

class MyLinear(snt.Module):

  def __init__(self, output_size, name=None):
    super(MyLinear, self).__init__(name=name)
    self.output_size = output_size

  @snt.once
  def _initialize(self, x):
    initial_w = tf.random.normal([x.shape[1], self.output_size])
    self.w = tf.Variable(initial_w, name="w")
    self.b = tf.Variable(tf.zeros([self.output_size]), name="b")

  def __call__(self, x):
    self._initialize(x)
    return tf.matmul(x, self.w) + self.b

Using this module is trivial:

mod = MyLinear(32)
mod(tf.ones([batch_size, input_size]))

By subclassing snt.Module you get many nice properties for free. For example a default implementation of __repr__ which shows constructor arguments (very useful for debugging and introspection):

>>> print(repr(mod))
MyLinear(output_size=10)

You also get the variables and trainable_variables properties:

>>> mod.variables
(<tf.Variable 'my_linear/b:0' shape=(10,) ...)>,
 <tf.Variable 'my_linear/w:0' shape=(1, 10) ...)>)

You may notice the my_linear prefix on the variables above. This is because Sonnet modules also enter the modules name scope whenever methods are called. By entering the module name scope we provide a much more useful graph for tools like TensorBoard to consume (e.g. all operations that occur inside my_linear will be in a group called my_linear).

Additionally your module will now support TensorFlow checkpointing and saved model which are advanced features covered later.

Serialization

Sonnet supports multiple serialization formats. The simplest format we support is Python's pickle, and all built in modules are tested to make sure they can be saved/loaded via pickle in the same Python process. In general we discourage the use of pickle, it is not well supported by many parts of TensorFlow and in our experience can be quite brittle.

TensorFlow Checkpointing

Reference: https://www.tensorflow.org/alpha/guide/checkpoints

TensorFlow checkpointing can be used to save the value of parameters periodically during training. This can be useful to save the progress of training in case your program crashes or is stopped. Sonnet is designed to work cleanly with TensorFlow checkpointing:

checkpoint_root = "/tmp/checkpoints"
checkpoint_name = "example"
save_prefix = os.path.join(checkpoint_root, checkpoint_name)

my_module = create_my_sonnet_module()  # Can be anything extending snt.Module.

# A `Checkpoint` object manages checkpointing of the TensorFlow state associated
# with the objects passed to it's constructor. Note that Checkpoint supports
# restore on create, meaning that the variables of `my_module` do **not** need
# to be created before you restore from a checkpoint (their value will be
# restored when they are created).
checkpoint = tf.train.Checkpoint(module=my_module)

# Most training scripts will want to restore from a checkpoint if one exists. This
# would be the case if you interrupted your training (e.g. to use your GPU for
# something else, or in a cloud environment if your instance is preempted).
latest = tf.train.latest_checkpoint(checkpoint_root)
if latest is not None:
  checkpoint.restore(latest)

for step_num in range(num_steps):
  train(my_module)

  # During training we will occasionally save the values of weights. Note that
  # this is a blocking call and can be slow (typically we are writing to the
  # slowest storage on the machine). If you have a more reliable setup it might be
  # appropriate to save less frequently.
  if step_num and not step_num % 1000:
    checkpoint.save(save_prefix)

# Make sure to save your final values!!
checkpoint.save(save_prefix)

TensorFlow Saved Model

Reference: https://www.tensorflow.org/alpha/guide/saved_model

TensorFlow saved models can be used to save a copy of your network that is decoupled from the Python source for it. This is enabled by saving a TensorFlow graph describing the computation and a checkpoint containing the value of weights.

The first thing to do in order to create a saved model is to create a snt.Module that you want to save:

my_module = snt.nets.MLP([1024, 1024, 10])
my_module(tf.ones([1, input_size]))

Next, we need to create another module describing the specific parts of our model that we want to export. We advise doing this (rather than modifying the original model in-place) so you have fine grained control over what is actually exported. This is typically important to avoid creating very large saved models, and such that you only share the parts of your model you want to (e.g. you only want to share the generator for a GAN but keep the discriminator private).

@tf.function(input_signature=[tf.TensorSpec([None, input_size])])
def inference(x):
  return my_module(x)

to_save = snt.Module()
to_save.inference = inference
to_save.all_variables = list(my_module.variables)
tf.saved_model.save(to_save, "/tmp/example_saved_model")

We now have a saved model in the /tmp/example_saved_model folder:

$ ls -lh /tmp/example_saved_model
total 24K
drwxrwsr-t 2 tomhennigan 154432098 4.0K Apr 28 00:14 assets
-rw-rw-r-- 1 tomhennigan 154432098  14K Apr 28 00:15 saved_model.pb
drwxrwsr-t 2 tomhennigan 154432098 4.0K Apr 28 00:15 variables

Loading this model is simple and can be done on a different machine without any of the Python code that built the saved model:

loaded = tf.saved_model.load("/tmp/example_saved_model")

# Use the inference method. Note this doesn't run the Python code from `to_save`
# but instead uses the TensorFlow Graph that is part of the saved model.
loaded.inference(tf.ones([1, input_size]))

# The all_variables property can be used to retrieve the restored variables.
assert len(loaded.all_variables) > 0

Note that the loaded object is not a Sonnet module, it is a container object that has the specific methods (e.g. inference) and properties (e.g. all_variables) that we added in the previous block.

Distributed training

Example: https://github.com/deepmind/sonnet/blob/v2/examples/distributed_cifar10.ipynb

Sonnet has support for distributed training using custom TensorFlow distribution strategies.

A key difference between Sonnet and distributed training using tf.keras is that Sonnet modules and optimizers do not behave differently when run under distribution strategies (e.g. we do not average your gradients or sync your batch norm stats). We believe that users should be in full control of these aspects of their training and they should not be baked into the library. The trade off here is that you need to implement these features in your training script (typically this is just 2 lines of code to all reduce your gradients before applying your optimizer) or swap in modules that are explicitly distribution aware (e.g. snt.distribute.CrossReplicaBatchNorm).

Our distributed Cifar-10 example walks through doing multi-GPU training with Sonnet.

sonnet's People

Contributors

adria-p avatar aslanides avatar chr1sj0nes avatar dependabot[bot] avatar diegolascasas avatar dm-jrae avatar fastturtle avatar fvioladm avatar hanbyul-kim avatar ialong avatar jeffdonahue avatar joaogui1 avatar joker-eph avatar kenfranko avatar lenamartens avatar liusiqi43 avatar lorenrose1013 avatar malcolmreynolds avatar markdaoust avatar msajjadi-g avatar petebu avatar sonnet-copybara avatar sracaniere avatar superbobry avatar tamaranorman avatar tirkarthi avatar tomhennigan avatar vierja avatar yilei avatar zafarali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sonnet's Issues

Breaks after upgrading to TensorFlow 1.2.0

While building docker images, noticed that sonnet breaks with the new version of TF 1.2.0.

root@a28ad161d26d:/# python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sonnet as snt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.5/site-packages/sonnet/__init__.py", line 109, in <module>
    from sonnet.python.ops.resampler import resampler
  File "/opt/conda/lib/python3.5/site-packages/sonnet/python/ops/resampler.py", line 33, in <module>
    tf.resource_loader.get_path_to_datafile("_resampler.so"))
  File "/opt/conda/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 64, in load_op_library
    None, None, error_msg, error_code)
tensorflow.python.framework.errors_impl.NotFoundError: /opt/conda/lib/python3.5/site-packages/sonnet/python/ops/_resampler.so: undefined symbol: _ZN10tensorflow15shape_inference16InferenceContext15WithRankAtLeastENS0_11ShapeHandleEiPS2_

TensorFlow was installed via pip, sonnet was compiled and installed from sources. Perhaps, updating the TF submodule with headers should solve this.

pondering rnn occured some error when using regularizer

When I used pondering_rnn (Adaptive Computation Time) to wrap an LSTM cell and tried to use L2 regularization, there were some errors,

        initializer = {'b_gates':tf.truncated_normal_initializer(stddev=1.0), 
                       'w_gates':tf.truncated_normal_initializer(stddev=1.0)}
        regularizer = {'b_gates':tf.contrib.layers.l2_regularizer(0.1), 
                       'w_gates':tf.contrib.layers.l2_regularizer(0.1)}
        
        act_core = LSTM(hidden_size, regularizers=regularizer, initializers=initializer)
        self._controller = ACTCore(core=act_core, 
                                   output_size=self._out_width, 
                                   threshold=threshold, 
                                   get_state_for_halting=self._get_hidden_state)
        
        self._initial_state = self._controller.initial_state(self._batch_size)
        regularization_loss = tf.reduce_sum(tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES))

The error is as follows:

The node 'Sum' has inputs from different frames. The input 'Sum/input' is in frame 'rnn/while/act_core/while/rnn/while/act_core/while/'. The input 'range' is in frame ''.

Seems to be tf.while_loop the problem, but I do not know how to solve this problem

Young

Running rnn_shakespeare.py triggers an Attribute Error on python 3.6.1

As stated in the title, running the example rnn_shakespeare.py example triggers an attribute error types has no attribute StringTypes, eg:

Traceback (most recent call last): File "shake.py", line 309, in <module> tf.app.run() File "/usr/local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "shake.py", line 305, in main reduce_learning_rate_interval=FLAGS.reduce_learning_rate_interval) File "shake.py", line 180, in train name="shake_train") File "/usr/local/lib/python3.6/site-packages/sonnet/examples/dataset_shakespeare.py", line 111, in __init__ super(TinyShakespeareDataset, self).__init__(name=name) File "/usr/local/lib/python3.6/site-packages/sonnet/python/modules/base.py", line 118, in __init__ if not isinstance(name, types.StringTypes): AttributeError: module 'types' has no attribute 'StringTypes'

This is most likely due to the fact that StringTypes was deprecated, and then later removed from python3

using pip --no-dependencies to fix mac-pro/anaconda install bug

Machine : Mac Pro
Tensorflow 1.0.1 installed with method suggested for Anaconda ( in TensorFlow docs ).
Build and install Sonnet you get the following error even if correct TF is present:
pip install /tmp/sonnet/*.whl
Processing /tmp/sonnet/sonnet-1.0-py3-none-any.whl
Collecting nose-parameterized>=0.6.0 (from sonnet==1.0)
Downloading nose_parameterized-0.6.0-py2.py3-none-any.whl
Collecting tensorflow>=1.0.1 (from sonnet==1.0)
Could not find a version that satisfies the requirement tensorflow>=1.0.1 (from sonnet==1.0) (from versions: 0.12.1, 1.0.0, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2)
No matching distribution found for tensorflow>=1.0.1 (from sonnet==1.0)

work-around:
pip install /tmp/sonnet/*.whl --no-dependencies

Segmentation fault

My config:

Anaconda 2 + tensorflow (no gpu) / Ubuntu 16.04

I assemble sonnet as specified, except I build with following flag:

bazel build --config=opt :install --copt="-D_GLIBCXX_USE_CXX11_ABI=0"

I use this flag. because otherwise I get following error:

NotFoundError: /home/kovalenko/anaconda2/lib/python2.7/site-packages/sonnet/python/ops/_resampler.so: undefined symbol: _ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringB5cxx11Ev

Following code causes error Segmentation fault:

import numpy as np
import sonnet as snt
import tensorflow as tf

image = np.ones((1, 100, 100, 3))
image[0, 50, :, :] = 0
image[0, :, 50, :] = 0

shift = np.ones((100, 100, 2))
shift[:, :, 1] = 0
shift = np.expand_dims(shift, 0)

res = snt.resampler(tf.Variable(initial_value=image), tf.Variable(initial_value=shift))

init_op = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init_op)

# following line triggers error
x = res.eval(session=sess)

Non-homogeneousness of the module implemented by Sonnet.

This is probably not a defect of sonnet, however, I would like to share it to see on earth it is a potential bug or not.

Currently I implemented a multi-layer RNN model. The cell is intended of some customized one, the code is as follows:

import tensorflow as tf
import sonnet as snt

class Cell(snt.RNNCore):
    def __init__(self, hidden_size, name = "cell"):
        super(Cell, self).__init__(name = name)
        self._hidden_size = hidden_size
        with self._enter_variable_scope():
            self._update_lin = snt.Linear(output_size = hidden_size)
            self._reset_lin = snt.Linear(output_size = hidden_size)
            self._cell_seq = snt.Sequential([snt.Linear(output_size = hidden_size), tf.tanh])

    def _build(self, inputs, state):
        i_s = tf.concat([inputs, state], -1)
        reset = self._reset_lin(i_s)
        update = self._update_lin(i_s)
        cell = self._cell_seq(tf.concat([inputs, reset * state], -1))
        output = update * state + (1 - update) * cell

        return output, output

    @property
    def state_size(self):
        return tf.TensorShape([self._hidden_size])

    @property
    def output_size(self):
        return tf.TensorShape([self._hidden_size])

    def initial_state(self, batch_size):
        return tf.zeros([batch_size, self._hidden_size])

However, when I try to use the code to build a multi-layer RNN, the following way is work:

import tensorflow as tf
import sonnet as snt
from cell import Cell

class Model(snt.AbstractModule):
    def __init__(self, batch_size, num_layers = 2, hidden_size = 8, name = "model"):
        super(Model, self).__init__(name = name)
        self._batch_size = batch_size
        self._num_layers = num_layers
        self._hidden_size = hidden_size
        with self._enter_variable_scope():
            self._cell1 = Cell(8)
            self._cell2 = Cell(8)
            # self._cells = tf.nn.rnn_cell.MultiRNNCell([Cell(8)] * num_layers, state_is_tuple = True)
            self._seq = snt.Sequential([snt.Linear(output_size = 1), tf.tanh])

    def _build(self, inputs):

        init_state = self._cell1.initial_state(self._batch_size)
        outputs, _ = tf.nn.dynamic_rnn(self._cell1, inputs, initial_state = init_state)

        init_state = self._cell2.initial_state(self._batch_size)
        outputs, _ = tf.nn.dynamic_rnn(self._cell2, outputs, initial_state = init_state)

        '''
        init_state = self._cells.zero_state(self._batch_size, tf.float32)
        outputs, states = tf.nn.dynamic_rnn(self._cells, inputs, initial_state = init_state)
        '''

        outputs = tf.unstack(outputs, axis = 1)
        outputs = self._seq(outputs[-1])

        return outputs

But the way below is not, which is believed equivalent to the above approach:

import tensorflow as tf
import sonnet as snt
from cell import Cell

class Model(snt.AbstractModule):
    def __init__(self, batch_size, num_layers = 2, hidden_size = 8, name = "model"):
        super(Model, self).__init__(name = name)
        self._batch_size = batch_size
        self._num_layers = num_layers
        self._hidden_size = hidden_size
        with self._enter_variable_scope():
            # self._cell1 = Cell(8)
            # self._cell2 = Cell(8)
            self._cells = tf.nn.rnn_cell.MultiRNNCell([Cell(8)] * num_layers, state_is_tuple = True)
            self._seq = snt.Sequential([snt.Linear(output_size = 1), tf.tanh])

    def _build(self, inputs):

        '''
        init_state = self._cell1.initial_state(self._batch_size)
        outputs, _ = tf.nn.dynamic_rnn(self._cell1, inputs, initial_state = init_state)

        init_state = self._cell2.initial_state(self._batch_size)
        outputs, _ = tf.nn.dynamic_rnn(self._cell2, outputs, initial_state = init_state)

        '''
        init_state = self._cells.zero_state(self._batch_size, tf.float32)
        outputs, states = tf.nn.dynamic_rnn(self._cells, inputs, initial_state = init_state)


        outputs = tf.unstack(outputs, axis = 1)
        outputs = self._seq(outputs[-1])

        return outputs

You can test above code using the following code snippet:

def test():

    import os
    os.environ["CUDA_VISIBLE_DEVICES"]="0"

    t = tf.constant([[[1], [2], [3], [4], [5], [6]],
                 [[2], [3], [4], [5], [6], [7]],
                 [[3], [4], [5], [6], [7], [8]],
                 [[4], [5], [6], [7], [8], [9]]], tf.float32)

    model = Model(4)
    r = model(t)

    with tf.Session() as sess:
        sess.run(tf.global_variables_initializer())
        v = sess.run(r)
        print(v)

if __name__ == "__main__":
    test()

I am appreciating any engineer in Deepmind can take time to look into it, many thanks.

I am trying to get sonnet installed I like the idea of some of the configure features but i would like a little more documentation on getting the full featured configured sonnet

I am trying to get sonnet installed I like the idea of some of the configure features but i would like a little more documentation on getting the full featured configured sonnet.

OpenCL and if I can get the ANN in a FPGA would be a great tutorial.

Video tutorials could help cover details.

There are free screencasting linux and windows software.

cannot make sonnet working!!

Hi, I'm trying to simply install sonnet, but it is not working. I used instructions on the first page and also did sudo python setup.py build && python setup.py install

it seems to be installed fine but I get the following error, can someone tell me what is going on?:
`

import sonnet as snt
import tensorflow as tf
snt.resampler(tf.constant([0.]), tf.constant([0.]))
Traceback (most recent call last):
File "", line 1, in
File "sonnet/python/ops/resampler.py", line 65, in resampler
raise ImportError("_gen_resampler could not be imported.")
ImportError: _gen_resampler could not be imported.

`

issue installing sonnet on on tensorflow rc1.2 using compiled from source installation

Hi,
I am trying to install sonnet on top of tensorflow rc1.2 and get the following error:
/root/.cache/bazel/_bazel_root/76ab1f57e69b3872947e0ef757e4f315/external/org_tensorflow/tensorflow/workspace.bzl:7:6: file '@io_bazel_rules_closure//closure:defs.bzl' does not contain symbol 'web_library_external'.

I'm doing it in a docker image with Ubuntu 16:04 and Python 3.5
here is a link to a docker file replicating the issue
Using a similar DockerFile which uses tensorflow r1.1 in this link everything works fine.

Build fails on Ubuntu 16.04.1

I followed the instructions, and got this error when building:

ubuntu@BorisGPUMP2 [ /tmp/sonnet ]  (master)
[18:35]: bazel build --config=opt :install
zsh: correct 'build' to 'BUILD' [nyae]? n
.............
WARNING: Config values are not defined in any .rc file: opt
WARNING: /home/ubuntu/.cache/bazel/_bazel_ubuntu/73ef796d701fb86018fd94fe895372e2/external/org_tensorflow/tensorflow/workspace.bzl:72:5: tf_repo_name was specified to tf_workspace but is no longer used and will be removed in the future.
INFO: Found 1 target...
ERROR: /home/ubuntu/.cache/bazel/_bazel_ubuntu/73ef796d701fb86018fd94fe895372e2/external/protobuf/BUILD:241:1: C++ compilation of rule '@protobuf//:js_embed' failed: Process exited with status 1 [sandboxed].
src/main/tools/linux-sandbox-pid1.cc:257: "mount(/tmp/sonnet, tmp/sonnet, NULL, MS_BIND, NULL)": No such file or directory
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //:install failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/ubuntu/.cache/bazel/_bazel_ubuntu/73ef796d701fb86018fd94fe895372e2/external/org_tensorflow/tensorflow/core/BUILD:190:1 C++ compilation of rule '@protobuf//:js_embed' failed: Process exited with status 1 [sandboxed].
INFO: Elapsed time: 8.429s, Critical Path: 0.18s
[18:39]: lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

Custom Sonnet module fails to merit device placement

Recently I try to write some customized python modules based on Sonnet for processing EEG data, but due to the magnitude of EEG data, I want to utilize multiple GPUs for training, then problem emerges that I cannot figure it out.

According to my understanding, the paradigm for synchronous multi-GPU training requires the trainable variables resides on CPU, while operations are performed on GPU, and tensors are transported in between as required.

The problem is in my view such an arrangement is difficult for the Sonnet module. For example, considering the small module as follows:

import tensorflow as tf
import sonnet as snt

class RCNNOutput(snt.AbstractModule):
    def __init__(self, out_size, device_name, name = "rcnn_output"):
        super(RCNNOutput, self).__init__(name = name)
        with self._enter_variable_scope():
            with tf.device(device_name):
                bf = snt.BatchFlatten(name = "bf")
                fc0 = snt.Linear(output_size = 256, name = "fc0")
                fc1 = snt.Linear(output_size = out_size, name = "fc1")
                self._seq = snt.Sequential([bf, fc0, tf.nn.relu, fc1], name = "seq")

    def _build(self, inputs):
        return self._seq(inputs)

def test():
    import numpy as np

    rcnn_output = RCNNOutput(4, '/cpu:0')

    with tf.device('/cpu:0'):
        t = tf.constant(np.ones([8, 32, 32, 3]), np.float32)

    with tf.device('/gpu:0'):
        outputs = rcnn_output(t)

    writer = tf.summary.FileWriter("rcnn_output_output", tf.get_default_graph())

    config = tf.ConfigProto(log_device_placement = True)

    with tf.Session(config = config) as sess:
        sess.run([tf.global_variables_initializer(), tf.local_variables_initializer()])

        v = sess.run(outputs)
        print(v)

    writer.close()

if __name__ == "__main__":
    test()

whatever I tried, I cannot get the weights put on CPU, it always put on GPU, even I explicitly give the placement directive:

2017-08-31 21:51:11.250360: I tensorflow/core/common_runtime/simple_placer.cc:847] rcnn_output/fc1/b: (VariableV2)/job:localhost/replica:0/task:0/gpu:0
rcnn_output/fc1/b/read: (Identity): /job:localhost/replica:0/task:0/gpu:0
2017-08-31 21:51:11.250366: I tensorflow/core/common_runtime/simple_placer.cc:847] rcnn_output/fc1/b/read: (Identity)/job:localhost/replica:0/task:0/gpu:0
rcnn_output/fc1/b/Assign: (Assign): /job:localhost/replica:0/task:0/gpu:0
2017-08-31 21:51:11.250371: I tensorflow/core/common_runtime/simple_placer.cc:847] rcnn_output/fc1/b/Assign: (Assign)/job:localhost/replica:0/task:0/gpu:0
rcnn_output/fc1/w: (VariableV2): /job:localhost/replica:0/task:0/gpu:0
2017-08-31 21:51:11.250377: I tensorflow/core/common_runtime/simple_placer.cc:847] rcnn_output/fc1/w: (VariableV2)/job:localhost/replica:0/task:0/gpu:0
rcnn_output/fc1/w/read: (Identity): /job:localhost/replica:0/task:0/gpu:0

Only the constant tensor got put on CPU:
Const: (Const): /job:localhost/replica:0/task:0/cpu:0
2017-08-31 21:51:11.250690: I tensorflow/core/common_runtime/simple_placer.cc:847] Const: (Const)/job:localhost/replica:0/task:0/cpu:0

I sincerely appreciate if any engineer at Deepmind could look into the problem and many thanks for giving some suggestions.

Building encoder decoder?

I am now trying to build a Lstm encoder decoder framework using sonnet and tensorflow. I understand sonnet have the lstm module involved. I was trying to build encoder decoder with tf.contrib.seq2seq.decoder. However, I am not sure if this one builds encoder implicitly, and the decoder_inputs are encoder_input? Since in my case, I do not have any input for decoder but the output from previous step...
Is there any warpper in Sonnet for this kind of issue? Can you suggest some proper way to do this?

I herd results build from source but that could be more problems

Hi the install on this is very hard I do not know if resample is a module... I tried finding one and installing it.
I tried anaconda
I tried the gpu version first and figured uninstall and use python 2 and try with cpu only and minimal configuration no gpu no opencl...
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import sonnet as snt
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/sonnet/init.py", line 103, in
from sonnet.python.ops.resampler import resampler
File "/usr/local/lib/python2.7/dist-packages/sonnet/python/ops/resampler.py", line 33, in
tf.resource_loader.get_path_to_datafile("_resampler.so"))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/load_library.py", line 64, in load_op_library
None, None, error_msg, error_code)
tensorflow.python.framework.errors_impl.NotFoundError: /usr/local/lib/python2.7/dist-packages/sonnet/python/ops/_resampler.so: undefined symbol: _ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringB5cxx11Ev

$ ./bazel-bin/install needs absolute path

Ahoi!

I installed sonnet according to the readme, but I was stuck quite some time at this point:

$ ./bazel-bin/install /tmp/sonnet

I replaced /tmp/sonnet by some local relative directory path, which doesnt work, i.e. no .whl is generated. If I use ./bazel-bin/install with some absolute path everything works fine (read: breaks at another point).

I first thought that was a bazel issue, but some guys in the #bazel channel on irc convinced me otherwise.
I recommend either fixing the handling of relative paths in the ./bazel-bin/install script itself, throwing an error or at least pointing out the issue in the README.md. That way others may not be stuck for several hours, too.

Config issue on macOS

Simply follow the instructions produces the following error at the "./configure" on macOS:

Please specify the location of python. [Default is /usr/local/bin/python]:
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]:
sed: can't read : No such file or directory

Releases? Binary builds?

Using Sonnet is practice right now is really much harder than it should be:
Because no pre-built binaries are available and Sonnet isn't published on PyPI, every user has to go through the difficult process of installing bazel and building Sonnet themselves, as exemplified by the many issues filed by people having problems with the build process.
I have had to jump through many hoops to find a way to use Sonnet in a project which I train on Google Cloud ML Engine (the solution was to build Sonnet inside a Debian Docker container on my Mac and then to upload the resulting wheel to Google Cloud ML). This would have been much easier if binary builds were available for download.
Secondly there is no versioning yet, so it's extremely difficult to ensure different machines or environments actually run the same Sonnet version or to tell which commits break compatibility with previous versions.
I understand that Sonnet is an early piece of software, but given how widely you publicized the open-source release, could you comment on your plans to implement some versioning and packaging to make it more practical to use?

Fedora 24 Sonnet Installation Issue

posted on Issue #23 but since it's closed, I am guessing that it is not being review.

I used pip to upgrade TensorFlow to 1.1 but having an error when trying to configure the headers to bazel build:


[cmwatson@xx tensorflow]$ ./configure
Please specify the location of python. [Default is /usr/bin/python]:
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]:
Do you wish to use jemalloc as the malloc implementation? [Y/n]
jemalloc enabled
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N]
No Google Cloud Platform support will be enabled for TensorFlow
Do you wish to build TensorFlow with Hadoop File System support? [y/N]
No Hadoop File System support will be enabled for TensorFlow
Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N]
No XLA support will be enabled for TensorFlow
Found possible Python library paths:
  /usr/lib/python2.7/site-packages
  /usr/lib64/python2.7/site-packages
Please input the desired Python library path to use.  Default is [/usr/lib/python2.7/site-packages]

Using python library path: /usr/lib/python2.7/site-packages
Do you wish to build TensorFlow with OpenCL support? [y/N]
No OpenCL support will be enabled for TensorFlow
Do you wish to build TensorFlow with CUDA support? [y/N]
No CUDA support will be enabled for TensorFlow
Configuration finished
Warning: ignoring http_proxy in environment.
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
Warning: ignoring http_proxy in environment.
...........
ERROR: /home/cmwatson/sonnet/tensorflow/tensorflow/tensorboard/bower/BUILD:5:1: no such package '@weblas_weblas_js//file': Error downloading [https://raw.githubusercontent.com/waylonflinn/weblas/v0.9.0/dist/weblas.js] to /home/cmwatson/.cache/bazel/_bazel_cmwatson/69b7f2b22f6b880ca0a532b8cb646acd/external/weblas_weblas_js/weblas.js: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target and referenced by '//tensorflow/tensorboard/bower:bower'.
ERROR: /home/cmwatson/.cache/bazel/_bazel_cmwatson/69b7f2b22f6b880ca0a532b8cb646acd/external/com_google_dagger/BUILD:13:1: no such package '@com_google_dagger_compiler//': java.io.IOException: Error downloading [http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/dagger/dagger-compiler/2.8/dagger-compiler-2.8.jar, http://maven.ibiblio.org/maven2/com/google/dagger/dagger-compiler/2.8/dagger-compiler-2.8.jar, http://repo1.maven.org/maven2/com/google/dagger/dagger-compiler/2.8/dagger-compiler-2.8.jar] to /home/cmwatson/.cache/bazel/_bazel_cmwatson/69b7f2b22f6b880ca0a532b8cb646acd/external/com_google_dagger_compiler/dagger-compiler-2.8.jar: Tried to reconnect at offset 8,481,153 but server didn't support it and referenced by '@com_google_dagger//:com_google_dagger'.
ERROR: Evaluation of query "deps(((//tensorflow/... - //tensorflow/contrib/nccl/...) - //tensorflow/examples/android/...))" failed: errors were encountered while computing transitive closure.

I have never used bazel, so hopefully this is a trivial fix, but I'm inexperienced.

Avoid duplicated scope names when using `_enter_variable_scope`.

It seems like when you are using self._enter_variable_scope in the __init__ you end up with a "module"_1 scope for you main ops.

It's very annoying and confusing to look at the Tensorboard when that happens (example below).

I've written a simple two-submodule module in Sonnet. The prints I get are:

['main_module_1/submodule_a/Variable:0', 'main_module_1/submodule_b/Variable:0']
['main_module/submodule_a/Variable:0', 'main_module/submodule_b/Variable:0']

I tried looking into how to "fix" it but I need some guidance of the possible ways to do it (without tearing the whole thing apart).

image

A better implementation of device placement?

It is known Sonnet module fails to merit the simple device placement directive, which was addressed as in issue #61 , there @kosklain offered a good solution. However there is a tiny problem in practice. Just look at the demonstrating code below:

import tensorflow as tf
import sonnet as snt

class RCNNOutput(snt.AbstractModule):
    def __init__(self, out_size, name = "rcnn_output"):
        super(RCNNOutput, self).__init__(name = name)
        with self._enter_variable_scope():
            bf = snt.BatchFlatten(name = "bf")
            fc0 = snt.Linear(output_size = 256, name = "fc0")
            fc1 = snt.Linear(output_size = out_size, name = "fc1")
            self._seq = snt.Sequential([bf, fc0, tf.nn.relu, fc1], name = "seq")

    def _build(self, inputs):
        return self._seq(inputs)

def test():
    import numpy as np
    from tensorflow.core.framework import node_def_pb2

    num_gpus = 2

    def get_device_setter(gpu_id):
        def device_setter(op):
            _variable_ops = ["Variable", "VariableV2", "VarHandleOp"]
            node_def = op if isinstance(op, node_def_pb2.NodeDef) else op.node_def
            return  '/cpu:0' if node_def.op in _variable_ops else '/gpu:%d' % gpu_id
        return device_setter

    with tf.device(get_device_setter(0)):
        rcnn_output = RCNNOutput(4)

    with tf.device('/cpu:0'):
        t = tf.constant(np.ones([8, 32, 32, 3]), np.float32)
        ts = tf.split(t, num_gpus)

    total_outputs = []
    for i in range(num_gpus):
        with tf.device(get_device_setter(i)):
            output = rcnn_output(ts[i])
            total_outputs.append(output)

    total_outputs = tf.add_n(total_outputs)

    writer = tf.summary.FileWriter("rcnn_output_output", tf.get_default_graph())

    config = tf.ConfigProto(log_device_placement = True)

    with tf.Session(config = config) as sess:
        sess.run([tf.global_variables_initializer(), tf.local_variables_initializer()])

        v = sess.run(total_outputs)
        print(v)

    writer.close()

if __name__ == "__main__":
    test()

The first concern is the following code snippet in the above code example:

    with tf.device(get_device_setter(0)):
        rcnn_output = RCNNOutput(4)
        t = tf.constant(np.ones([8, 32, 32, 3]), np.float32)

Here 0 is just for some placeholder purpose, since the intention is to have the model parameters placed on CPU, in order to be shared across multiple GPUs. Although I could define get_device_setter in some prototype like get_device_setter(gpu_id = 0), probably someone still makes the criticism that here the sole intention is to construct everything on CPU, why a GPU ID involves?

The criticism is tended to be a little stronger when the code snippet below is added together:

    with tf.device('/cpu:0'):
        t = tf.constant(np.ones([8, 32, 32, 3]), np.float32)
        ts = tf.split(t, num_gpus)

The intention here is we have all inputs prepared on CPU. So people will say, why you mix directives together, why you can not place them under one directive? Simply answering because Sonnet doesn't support the simple device placement directive, so it is can not be done in a harmonic way, is probably not a good answer to ease every skepticism.

So I just wonder could it be done a little nicer than the above approach, namely use a more obvious directive for a neatly placement control both for inputs preparation and model construction?

Many thanks.

Windows support

Is windows support planned?

I didn't manage to run the ./configure script of tensorflow. However, by moving the BUILD file to a new name, i could install sonnet by doing a simple
python setup.py install

I did not encounter bugs other than the complicated setup.

_resampler.so: undefined symbol

faced this error while executing the example code

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

recompiling the tensorflow to 1.1.0-rc2 and replacing the downloaded sonnet/tensorflow with this one solved the problem :)

Potentially redundant bias in convLSTM

https://github.com/deepmind/sonnet/blob/7da90b8e63fb684b91a12e1e9a42999962804e3a/sonnet/python/modules/gated_rnn.py#L1129

Hi, I realized that the variable of convLSTM includes two biases if use_bias is set to true. And I think it is because here the convolution is performed separately on input and state. But effectively only one set of bias is necessary. Perhaps adding bias at the end instead of within the convolution as done in the tensorflow contrib version (https://github.com/tensorflow/tensorflow/pull/8891/files) would be better.

A question about LayerNorm

I noticed sonnet has provided a module called LayerNorm, which is based on the article https://arxiv.org/abs/1607.06450.
However, when I look at the corresponding implementation of TensowFlow, it provides a class called LayerNormBasicLSTMCell (TensorFlow does provides a standalone version of layer normalization tf.contrib.layers.layer_norm).
According to my understanding, and when I check the code in https://github.com/tensorflow/tensorflow/blob/r1.3/tensorflow/contrib/rnn/python/ops/rnn_cell.py:


    i, j, f, o = array_ops.split(value=concat, num_or_size_splits=4, axis=1)
    if self._layer_norm:
      i = self._norm(i, "input")
      j = self._norm(j, "transform")
      f = self._norm(f, "forget")
      o = self._norm(o, "output")


What I mean here is the layer normalization is done INSIDE the cell, before activation. However, when sonnet provides the solo LayerNorm module in sonnet, in which way it is intended to be used? Like the following way:

import numpy as np
import tensorflow as tf
import sonnet as snt

class Model(snt.AbstractModule):
    def __init__(self, name = "model"):
        super(Model, self).__init__(name = name)

        hidden_size_array = [8, 8, 8]
        with self._enter_variable_scope():
            self._layer1 = snt.LSTM(hidden_size_array[0], name = 'layer1_lstm')
            self._norm1 = snt.BatchApply(snt.LayerNorm(), name = 'layer1_norm')

            self._layer2 = snt.LSTM(hidden_size_array[1], name = 'layer2_lstm')
            self._norm2 = snt.BatchApply(snt.LayerNorm(), name = 'layer2_norm')

            self._layer3 = snt.LSTM(hidden_size_array[2], name = 'layer3_lstm')
            self._norm3 = snt.BatchApply(snt.LayerNorm(), name = 'layer3_norm')


    def _build(self, inputs):

        batch_size = inputs.get_shape()[0]

        initial_state = self._layer1.initial_state(batch_size)
        output_sequence, final_state = \
            tf.nn.dynamic_rnn(self._layer1, inputs, initial_state = initial_state, time_major = False)

        output_sequence = self._norm1(output_sequence)

        initial_state = self._layer2.initial_state(batch_size)
        output_sequence, final_state = \
            tf.nn.dynamic_rnn(self._layer2, output_sequence, initial_state = initial_state, time_major = False)

        output_sequence = self._norm2(output_sequence)

        initial_state = self._layer3.initial_state(batch_size)
        output_sequence, final_state = \
            tf.nn.dynamic_rnn(self._layer3, output_sequence, initial_state = initial_state, time_major = False)

        output_sequence = self._norm3(output_sequence)

        return output_sequence

def test():

    t = tf.constant(np.ones((4, 6, 8)), tf.float32)
    model = Model()
    outputs = model(t)

    with tf.Session() as sess:
        sess.run([tf.global_variables_initializer()])

        v = sess.run(outputs)
        print(v)

if __name__ == "__main__":
    test()

Nevertheless in this way it can work, however, seems layer normalization is done outside the activation of LSTM cell.

So I just wonder the dear engineers at DeepMind could give a doc a little detailed with regarding to the usage of LayerNorm module or not? (Or even probably my understanding of layer normalization is wrong). But I would like to hear the opinion of engineers there, so by clarification we can have sonnet easier to use.

Thanks a lot.

Build failed with JDK 7

I am using Ubuntu 14.04, and installed bazel with jdk1.7. The build failed with a java exception.

After I updated jdk to 1.8 version and reinstalled the corresponding bazel, the build succeeded.

Since bazel still supports jdk1.7, I wonder if you could specify the jdk requirement in installation instructions if sonnet does not.

The error is like this:

java.lang.NoSuchMethodError: java.util.Map.putIfAbsent(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
        at com.google.devtools.build.lib.actions.CompositeRunfilesSupplier.getMappings(CompositeRunfilesSupplier.java:69)
        at com.google.devtools.build.lib.sandbox.SpawnHelpers.mountRunfilesFromSuppliers(SpawnHelpers.java:146)
        at com.google.devtools.build.lib.sandbox.SpawnHelpers.getMounts(SpawnHelpers.java:55)
        at com.google.devtools.build.lib.sandbox.SandboxStrategy.getMounts(SandboxStrategy.java:153)
        at com.google.devtools.build.lib.sandbox.LinuxSandboxedStrategy.getMounts(LinuxSandboxedStrategy.java:42)
        at com.google.devtools.build.lib.sandbox.LinuxSandboxedStrategy.exec(LinuxSandboxedStrategy.java:121)
        at com.google.devtools.build.lib.sandbox.LinuxSandboxedStrategy.exec(LinuxSandboxedStrategy.java:90)
        at com.google.devtools.build.lib.analysis.actions.SpawnAction.internalExecute(SpawnAction.java:266)
        at com.google.devtools.build.lib.rules.genrule.GenRuleAction.internalExecute(GenRuleAction.java:73)
        at com.google.devtools.build.lib.analysis.actions.SpawnAction.execute(SpawnAction.java:274)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.executeActionTask(SkyframeActionExecutor.java:778)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.prepareScheduleExecuteAndCompleteAction(SkyframeActionExecutor.java:718)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.access$800(SkyframeActionExecutor.java:102)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.call(SkyframeActionExecutor.java:608)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.call(SkyframeActionExecutor.java:570)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.executeAction(SkyframeActionExecutor.java:380)
        at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.checkCacheAndExecuteIfNeeded(ActionExecutionFunction.java:440)
        at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:196)
        at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:374)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:501)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

Avoid duplicated scope names (for operations?) when using `_enter_variable_scope`

Continuing on #50 I am still not sure the self._enter_variable_scope is having the correct effect on operation naming in Tensorboard.

I've written a simple module -> submodule example with and without _enter_variable_scope and I've got different graphs in Tensorboard.

Even though the variables end up being the same:

['main_module/linear/w:0', 'main_module/linear/b:0']
['main_module/linear/w:0', 'main_module/linear/b:0']

I get these two different graphs in Tensorboard:

with snt.Lineardefined on the _build method:
image

with snt.Linear defined on the init with _enter_variable_scope:
image

Fedora 24 unable to import sonnet

Fedora 24, tensorflow 1.0.1, bazel 0.4.5
Installing sonnet seems to have been successful (Requirement already satisfied: sonnet==1.0.....), including installing jdk8, bazel, sonnet, and the ./configure for tensorflow. But when I try to import sonnet, I get the error below. Any suggestions?

import sonnet as snt
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/sonnet/init.py", line 102, in
from sonnet.python.ops.resampler import resampler
File "/usr/lib/python2.7/site-packages/sonnet/python/ops/resampler.py", line 33, in
tf.resource_loader.get_path_to_datafile("_resampler.so"))
File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/load_library.py", line 64, in load_op_library
None, None, error_msg, error_code)
tensorflow.python.framework.errors_impl.NotFoundError: /usr/lib/python2.7/site-packages/sonnet/python/ops/_resampler.so: undefined symbol: _ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringB5cxx11Ev

However, works if I switch to the sonnet directory, then import, but then testing it I get an ImportError:

import sonnet as snt
import tensorflow as tf
snt.resampler(tf.constant([0.]), tf.constant([0.]))
Traceback (most recent call last):
File "", line 1, in
File "sonnet/python/ops/resampler.py", line 65, in resampler
raise ImportError("_gen_resampler could not be imported.")
ImportError: _gen_resampler could not be imported.

I did uninstall sonnet before installing the whl file.

Problem installing sonnet on a GPU machine

I have a CUDA supported CentOS 7 GPU machine with TF version 1.1.0 and tried to install sonnet

When I run

./configure

I get

ERROR: /home/xbbl35h/code/sonnet/tensorflow/WORKSPACE:3:1: //external:io_bazel_rules_closure: no such attribute 'urls' in 'http_archive' rule. ERROR: /home/xbbl35h/code/sonnet/tensorflow/WORKSPACE:3:1: //external:io_bazel_rules_closure: missing value for mandatory attribute 'url' in 'http_archive' rule. ERROR: com.google.devtools.build.lib.packages.BuildFileContainsErrorsException: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': error loading package 'external': Could not load //external package.

I saw that someone had posted a change and I have the WORKSPACE file changed to

http_file(
  name = "weblas_weblas_js",
  url = "file:///local_path/weblas.js",
)

I suspect it is something simple

Configure failed on Mac OSX

I get:

sudo bazel build --config=opt :install
Password:
Extracting Bazel installation...
.........
WARNING: Config values are not defined in any .rc file: opt
WARNING: /private/var/tmp/_bazel_root/81097c8f44aae43fe60488543d11a0e1/external/org_tensorflow/tensorflow/workspace.bzl:72:5: tf_repo_name was specified to tf_workspace but is no longer used and will be removed in the future.
WARNING: /Users/CBrauer/sonnet/sonnet/python/BUILD:119:1: in srcs attribute of cc_binary rule //sonnet/python:ops/_resampler.so: please do not import '//sonnet/cc:ops/resampler.cc' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'tf_custom_op_library', the error might have been caused by the macro implementation in /Users/CBrauer/sonnet/sonnet/tensorflow.bzl:108:25.
WARNING: /Users/CBrauer/sonnet/sonnet/python/BUILD:119:1: in srcs attribute of cc_binary rule //sonnet/python:ops/_resampler.so: please do not import '//sonnet/cc/kernels:resampler_op.cc' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'tf_custom_op_library', the error might have been caused by the macro implementation in /Users/CBrauer/sonnet/sonnet/tensorflow.bzl:108:25.
WARNING: /Users/CBrauer/sonnet/sonnet/python/BUILD:119:1: in srcs attribute of cc_binary rule //sonnet/python:ops/_resampler.so: please do not import '//sonnet/cc/kernels:resampler_op.h' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'tf_custom_op_library', the error might have been caused by the macro implementation in /Users/CBrauer/sonnet/sonnet/tensorflow.bzl:108:25.
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_root/81097c8f44aae43fe60488543d11a0e1/external/gif_archive/BUILD.bazel:8:1: C++ compilation of rule '@gif_archive//:gif' failed: Process exited with status 1 [sandboxed].
couldn't understand kern.osversion `16.5.0'
cc1: error: unrecognized command line option "-Wthread-safety"
cc1: error: unrecognized command line option "-Wself-assign"
cc1: warning: unrecognized command line option "-Wno-free-nonheap-object"
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //:install failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 12.066s, Critical Path: 0.19s

Please help.

Charles

Bugs with the documentation and example code in Sonnet from DeepMInd

import sonnet as snt

train_data = get_training_data()
test_data = get_test_data()

# Construct the module, providing any configuration necessary.
linear_regression_module = snt.Linear(output_size=FLAGS.output_size)

# Connect the module to some inputs, any number of times.
train_predictions = linear_regression_module(train_data)
test_predictions = linear_regression_module(test_data)

get_training_data() doesn't work and nor does the get_test_data() functions respectively.

Also, there is no documentation on how to run the examples with the Shakespeare dataset in /sonnet/sonnet/examples.

Finally, I had to comment the following lines in the source code of Sonnet in lines 42-44 of nest.py inside /sonnet/sonnet/python/ops/:

#map_up_to = nest.map_structure_up_to
#assert_shallow_structure = nest.assert_shallow_structure
#flatten_up_to = nest.flatten_up_to

for the code to run.

Could you please let me know if the current version of Sonnet is compatible with Tensorflow 1.3.0?

Bazel build failure on Ubuntu14.04

(tensorflow-1.0.1)sj@vipa-Precision-Tower-7910:~/software/sonnet$ bazel build --strategy=CppCompile=standalone --verbose_failures --config=opt :install
WARNING: Config values are not defined in any .rc file: opt
WARNING: /home/sj/.cache/bazel/_bazel_sj/be13dc62f2ab4b36343926cedc20e2d6/external/org_tensorflow/tensorflow/workspace.bzl:72:5: tf_repo_name was specified to tf_workspace but is no longer used and will be removed in the future.
WARNING: /home/sj/software/sonnet/sonnet/python/BUILD:127:1: in srcs attribute of cc_binary rule //sonnet/python:ops/_resampler.so: please do not import '//sonnet/cc:ops/resampler.cc' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'tf_custom_op_library', the error might have been caused by the macro implementation in /home/sj/software/sonnet/sonnet/tensorflow.bzl:108:25.
WARNING: /home/sj/software/sonnet/sonnet/python/BUILD:127:1: in srcs attribute of cc_binary rule //sonnet/python:ops/resampler.so: please do not import '//sonnet/cc/kernels:resampler_op.cc' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'tf_custom_op_library', the error might have been caused by the macro implementation in /home/sj/software/sonnet/sonnet/tensorflow.bzl:108:25.
WARNING: /home/sj/software/sonnet/sonnet/python/BUILD:127:1: in srcs attribute of cc_binary rule //sonnet/python:ops/resampler.so: please do not import '//sonnet/cc/kernels:resampler_op.h' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'tf_custom_op_library', the error might have been caused by the macro implementation in /home/sj/software/sonnet/sonnet/tensorflow.bzl:108:25.
INFO: Found 1 target...
ERROR: /home/sj/.cache/bazel/bazel_sj/be13dc62f2ab4b36343926cedc20e2d6/external/org_tensorflow/tensorflow/core/BUILD:1150:1: C++ compilation of rule '@org_tensorflow//tensorflow/core:lib_internal' failed: gcc failed: error executing command
(cd /home/sj/.cache/bazel/bazel_sj/be13dc62f2ab4b36343926cedc20e2d6/execroot/sonnet &&
exec env -
LD_LIBRARY_PATH=/home/sj/software/opencv_2.4.9/lib/:/usr/local/cuda-8.0/lib64
PATH=/usr/local/cuda-8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
/usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections -g0 '-std=c++0x' -MD -MF bazel-out/host/bin/external/org_tensorflow/tensorflow/core/objs/lib_internal/external/org_tensorflow/tensorflow/core/lib/strings/str_util.d '-frandom-seed=bazel-out/host/bin/external/org_tensorflow/tensorflow/core/objs/lib_internal/external/org_tensorflow/tensorflow/core/lib/strings/str_util.o' -DEIGEN_MPL2_ONLY -iquote external/org_tensorflow -iquote bazel-out/host/genfiles/external/org_tensorflow -iquote external/bazel_tools -iquote bazel-out/host/genfiles/external/bazel_tools -iquote external/protobuf -iquote bazel-out/host/genfiles/external/protobuf -iquote external/eigen_archive -iquote bazel-out/host/genfiles/external/eigen_archive -iquote external/local_config_sycl -iquote bazel-out/host/genfiles/external/local_config_sycl -iquote external/gif_archive -iquote bazel-out/host/genfiles/external/gif_archive -iquote external/jpeg -iquote bazel-out/host/genfiles/external/jpeg -iquote external/com_googlesource_code_re2 -iquote bazel-out/host/genfiles/external/com_googlesource_code_re2 -iquote external/farmhash_archive -iquote bazel-out/host/genfiles/external/farmhash_archive -iquote external/highwayhash -iquote bazel-out/host/genfiles/external/highwayhash -iquote external/png_archive -iquote bazel-out/host/genfiles/external/png_archive -iquote external/zlib_archive -iquote bazel-out/host/genfiles/external/zlib_archive -isystem external/bazel_tools/tools/cpp/gcc3 -isystem external/protobuf/src -isystem bazel-out/host/genfiles/external/protobuf/src -isystem external/eigen_archive -isystem bazel-out/host/genfiles/external/eigen_archive -isystem external/gif_archive/lib -isystem bazel-out/host/genfiles/external/gif_archive/lib -isystem external/farmhash_archive/src -isystem bazel-out/host/genfiles/external/farmhash_archive/src -isystem external/png_archive -isystem bazel-out/host/genfiles/external/png_archive -isystem external/zlib_archive -isystem bazel-out/host/genfiles/external/zlib_archive -DEIGEN_AVOID_STL_ARRAY -Iexternal/gemmlowp -Wno-sign-compare -fno-exceptions -msse3 -pthread -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP
="redacted"' '-D__TIME
="redacted"' -c external/org_tensorflow/tensorflow/core/lib/strings/str_util.cc -o bazel-out/host/bin/external/org_tensorflow/tensorflow/core/_objs/lib_internal/external/org_tensorflow/tensorflow/core/lib/strings/str_util.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
In file included from external/org_tensorflow/tensorflow/core/lib/gtl/array_slice.h:101:0,
from external/org_tensorflow/tensorflow/core/lib/strings/str_util.h:23,
from external/org_tensorflow/tensorflow/core/lib/strings/str_util.cc:16:
external/org_tensorflow/tensorflow/core/lib/gtl/array_slice_internal.h:232:38: error: 'tensorflow::gtl::array_slice_internal::ArraySliceImplBase::ArraySliceImplBase' names constructor
external/org_tensorflow/tensorflow/core/lib/gtl/array_slice_internal.h:252:32: error: 'tensorflow::gtl::array_slice_internal::ArraySliceImplBase::ArraySliceImplBase' names constructor
In file included from external/org_tensorflow/tensorflow/core/lib/gtl/array_slice.h:102:0,
from external/org_tensorflow/tensorflow/core/lib/strings/str_util.h:23,
from external/org_tensorflow/tensorflow/core/lib/strings/str_util.cc:16:
external/org_tensorflow/tensorflow/core/lib/gtl/inlined_vector.h: In member function 'void tensorflow::gtl::InlinedVector<T, N>::Destroy(T*, int)':
external/org_tensorflow/tensorflow/core/lib/gtl/inlined_vector.h:396:10: error: 'is_trivially_destructible' is not a member of 'std'
external/org_tensorflow/tensorflow/core/lib/gtl/inlined_vector.h:396:42: error: expected primary-expression before '>' token
external/org_tensorflow/tensorflow/core/lib/gtl/inlined_vector.h:396:43: error: '::value' has not been declared
Target //:install failed to build
INFO: Elapsed time: 2.086s, Critical Path: 1.43s

Included TensorFlow CPU supported only?

After configuring sonnet, I found out tensorflow 1.01 is installed along with my original tensorflow-gpu 1.01. However only tensorflow 1.01 is recognized as the imported one... Plz share a instruction

Mac install fails

I am trying to install sonnet on Mac but I get the following error:
sonnet/sonnet/python/BUILD:131:1 C++ compilation of rule '@protobuf//:protobuf' failed: cc_wrapper.sh failed: error executing command
(exec env -
PATH=/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/swarsh/torch/install/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
TMPDIR=/var/folders/q9/1zzwnrpx5f31kw21mwzdqxjh0000gn/T/
external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections -g0 '-std=c++0x' -MD -MF bazel-out/host/bin/external/protobuf/objs/protobuf/external/protobuf/src/google/protobuf/struct.pb.d '-frandom-seed=bazel-out/host/bin/external/protobuf/objs/protobuf/external/protobuf/src/google/protobuf/struct.pb.o' -iquote external/protobuf -iquote bazel-out/host/genfiles/external/protobuf -iquote external/bazel_tools -iquote bazel-out/host/genfiles/external/bazel_tools -isystem external/protobuf/src -isystem bazel-out/host/genfiles/external/protobuf/src -isystem external/bazel_tools/tools/cpp/gcc3 -DHAVE_PTHREAD -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-unused-function -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/protobuf/src/google/protobuf/struct.pb.cc -o bazel-out/host/bin/external/protobuf/_objs/protobuf/external/protobuf/src/google/protobuf/struct.pb.o)

external/local_config_cc/cc_wrapper.sh: line 56: -U_FORTIFY_SOURCE: command not found

Issue during install package with pip

I have follow error when try to install Sonnet:

pip install dm-sonnet
Collecting dm-sonnet
Could not find a version that satisfies the requirement dm-sonnet (from versions: )
No matching distribution found for dm-sonnet

I use Windows10 and Tensorflow with GPU version 1.2.1

Run Sonnet on Google Cloud ML

Hi.

More than an issue, my question is if there is some easy way to run sonnet on Google Cloud Machine Learning, i have a code i would like to test on the cloud but is written using Sonnet and i get an import error trying to run it.
Maybe using the setup.py but i'm new building packages and nothing comes to my mind.

If this isn't the place for this question, I apologize.

Any help on this matter is really appreciated.
Thanks

Variables that aren't shared?

In the MyMLP example, it says:

new instances of snt.Linear are generated each time _build() is called, and you may think this will create different, unshared variables. This is not the case - only 4 variables (2 for each Linear) will be created, no matter how many times the MLP instance is connected into the graph. ****

So... what if I don't want the variables to be shared? For example, suppose I wanted to have a deeper net by stacking 4 MyMLP instances. I want each of them to have their own weights, not to share weights. Is this just not possible?

internal compiler error: in tsubst_copy, at cp/pt.c:13970 using gcc 6.2

I have been unable to install Sonnet because of a compiler error. I tried to find if this was a bug with gcc and I found similar entries, however updating gcc did not work. This error happened to me using verions 5.3 and 6.2 of gcc (output of the latter below).

abermea@host:~/Projects/Sonnet/sonnet$ bazel build --config=opt :install
.
WARNING: Config values are not defined in any .rc file: opt
WARNING: /home/abermea/.cache/bazel/_bazel_abermea/ca99c09533717eb94266b31b726808fb/external/org_tensorflow/tensorflow/workspace.bzl:72:5: tf_repo_name was specified to tf_workspace but is no longer used and will be removed in the future.
INFO: Found 1 target...
ERROR: /home/abermea/Projects/Sonnet/sonnet/sonnet/cc/kernels/BUILD:19:1: C++ compilation of rule '//sonnet/cc/kernels:resampler_op' failed: Process exited with status 1 [sandboxed].
sonnet/cc/kernels/resampler_op.cc: In instantiation of 'deepmind::tensorflow::sonnet::functor::ResamplerGrad2DFunctor<Eigen::ThreadPoolDevice, T>::operator()(tensorflow::OpKernelContext*, const CPUDevice&, const T*, const T*, const T*, T*, T*, int, int, int, int, int)::<lambda(int, int)>::<lambda(int, int, int, T)> [with T = double]':
sonnet/cc/kernels/resampler_op.cc:269:23:   required from 'struct deepmind::tensorflow::sonnet::functor::ResamplerGrad2DFunctor<Eigen::ThreadPoolDevice, T>::operator()(tensorflow::OpKernelContext*, const CPUDevice&, const T*, const T*, const T*, T*, T*, int, int, int, int, int)::<lambda(int, int)> [with T = double]::<lambda(int, int, int, double)>'
sonnet/cc/kernels/resampler_op.cc:272:9:   required from 'deepmind::tensorflow::sonnet::functor::ResamplerGrad2DFunctor<Eigen::ThreadPoolDevice, T>::operator()(tensorflow::OpKernelContext*, const CPUDevice&, const T*, const T*, const T*, T*, T*, int, int, int, int, int)::<lambda(int, int)> [with T = double]'
sonnet/cc/kernels/resampler_op.cc:317:38:   required from 'struct deepmind::tensorflow::sonnet::functor::ResamplerGrad2DFunctor<Eigen::ThreadPoolDevice, T>::operator()(tensorflow::OpKernelContext*, const CPUDevice&, const T*, const T*, const T*, T*, T*, int, int, int, int, int) [with T = double; deepmind::tensorflow::sonnet::CPUDevice = Eigen::ThreadPoolDevice]::<lambda(int, int)>'
sonnet/cc/kernels/resampler_op.cc:338:5:   required from 'void deepmind::tensorflow::sonnet::functor::ResamplerGrad2DFunctor<Eigen::ThreadPoolDevice, T>::operator()(tensorflow::OpKernelContext*, const CPUDevice&, const T*, const T*, const T*, T*, T*, int, int, int, int, int) [with T = double; deepmind::tensorflow::sonnet::CPUDevice = Eigen::ThreadPoolDevice]'
sonnet/cc/kernels/resampler_op.cc:407:51:   required from 'void deepmind::tensorflow::sonnet::ResamplerGradOp<Device, T>::Compute(tensorflow::OpKernelContext*) [with Device = Eigen::ThreadPoolDevice; T = double]'
sonnet/cc/kernels/resampler_op.cc:443:1:   required from here
sonnet/cc/kernels/resampler_op.cc:239:47: internal compiler error: in tsubst_copy, at cp/pt.c:13970
     const int data_batch_stride = data_height * data_width * data_channels;
                                   ~~~~~~~~~~~~^~~~~~~~~~~~
0x60e858 tsubst_copy
	../../src/gcc/cp/pt.c:13970
0x60efb1 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:17067
0x6102b8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:16252
0x6102b8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:16252
0x60aa58 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
	../../src/gcc/cp/pt.c:15876
0x60bab5 tsubst_init
	../../src/gcc/cp/pt.c:13916
0x60e8e6 tsubst_copy
	../../src/gcc/cp/pt.c:14109
0x60efb1 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:17067
0x6102d6 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:16253
0x6102b8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:16252
0x6102b8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:16252
0x60f2bf tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:16285
0x60fa64 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
	../../src/gcc/cp/pt.c:16390
0x60aa58 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
	../../src/gcc/cp/pt.c:15876
0x609686 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
	../../src/gcc/cp/pt.c:15192
0x60a903 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
	../../src/gcc/cp/pt.c:15364
0x609980 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
	../../src/gcc/cp/pt.c:15344
0x60a8bc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
	../../src/gcc/cp/pt.c:15178
0x60a903 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
	../../src/gcc/cp/pt.c:15364
0x60a8bc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
	../../src/gcc/cp/pt.c:15178
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //:install failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 34.787s, Critical Path: 11.86s

==========================================

abermea@host:~/Projects/Sonnet/sonnet$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.2.0-3ubuntu11~16.04' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.2.0 20160901 (Ubuntu 6.2.0-3ubuntu11~16.04) 


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.