GithubHelp home page GithubHelp logo

jadentravnik / dnc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from google-deepmind/dnc

0.0 1.0 0.0 70 KB

A TensorFlow implementation of the Differentiable Neural Computer.

License: Apache License 2.0

Python 100.00%

dnc's Introduction

Differentiable Neural Computer (DNC)

This package provides an implementation of the Differentiable Neural Computer, as published in Nature.

Any publication that discloses findings arising from using this source code must cite “Hybrid computing using a neural network with dynamic external memory", Nature 538, 471–476 (October 2016) doi:10.1038/nature20101.

Introduction

The Differentiable Neural Computer is a recurrent neural network. At each timestep, it has state consisting of the current memory contents (and auxiliary information such as memory usage), and maps input at time t to output at time t. It is implemented as a collection of RNNCore modules, which allow plugging together the different modules to experiment with variations on the architecture.

  • The access module is where the main DNC logic happens; as this is where memory is written to and read from. At every timestep, the input to an access module is a vector passed from the controller, and its output is the contents read from memory. It uses two futher RNNCores: TemporalLinkage which tracks the order of memory writes, and Freeness which tracks which memory locations have been written to and not yet subsequently "freed". These are both defined in addressing.py.

  • The controller module "controls" memory access. Typically, it is just a feedforward or (possibly deep) LSTM network, whose inputs are the inputs to the overall recurrent network at that time, concatenated with the read memory output from the access module from the previous timestep.

  • The dnc simply wraps the access module and the control module, and forms the basic RNNCore unit of the overall architecture. This is defined in dnc.py.

DNC architecture

Train

The DNC requires an installation of TensorFlow and Sonnet. An example training script is provided for the algorithmic task of repeatedly copying a given input string. This can be executed from a python interpreter:

$ ipython train.py

You can specify training options, including parameters to the model and optimizer, via flags:

$ python train.py --memory_size=64 --num_bits=8 --max_length=3

# Or with ipython:
$ ipython train.py -- --memory_size=64 --num_bits=8 --max_length=3

Periodically saving, or 'checkpointing', the model is disabled by default. To enable, use the checkpoint_interval flag. E.g. --checkpoint_interval=10000 will ensure a checkpoint is created every 10,000 steps. The model will be checkpointed to /tmp/tf/dnc/ by default. From there training can be resumed. To specify an alternate checkpoint directory, use the checkpoint_dir flag. Note: ensure that /tmp/tf/dnc/ is deleted before training is resumed with different model parameters, to avoid shape inconsistency errors.

More generally, the DNC class found within dnc.py can be used as a standard TensorFlow rnn core and unrolled with TensorFlow rnn ops, such as tf.nn.dynamic_rnn on any sequential task.

Disclaimer: This is not an official Google product

dnc's People

Contributors

dm-jrae avatar carusyte avatar shuolongbj avatar jramapuram avatar

Watchers

James Cloos avatar

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.