{"id":13837131,"url":"https://github.com/snipsco/ntm-lasagne","last_synced_at":"2025-07-16T12:44:35.428Z","repository":{"id":87167457,"uuid":"42666968","full_name":"snipsco/ntm-lasagne","owner":"snipsco","description":"Neural Turing Machines library in Theano with Lasagne","archived":false,"fork":false,"pushed_at":"2018-07-31T11:41:29.000Z","size":1209,"stargazers_count":300,"open_issues_count":15,"forks_count":51,"subscribers_count":59,"default_branch":"master","last_synced_at":"2024-11-20T23:34:26.125Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://medium.com/snips-ai/ntm-lasagne-a-library-for-neural-turing-machines-in-lasagne-2cdce6837315#.63t84s5r5","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snipsco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-09-17T16:14:50.000Z","updated_at":"2024-04-30T09:21:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"38908ffc-209f-4b2d-a1d7-e43617f7545c","html_url":"https://github.com/snipsco/ntm-lasagne","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/snipsco/ntm-lasagne","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snipsco%2Fntm-lasagne","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snipsco%2Fntm-lasagne/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snipsco%2Fntm-lasagne/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snipsco%2Fntm-lasagne/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snipsco","download_url":"https://codeload.github.com/snipsco/ntm-lasagne/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snipsco%2Fntm-lasagne/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264608131,"owners_count":23636683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T15:01:01.580Z","updated_at":"2025-07-10T16:32:09.544Z","avatar_url":"https://github.com/snipsco.png","language":"Python","funding_links":[],"categories":["Uncategorized","Python"],"sub_categories":["Uncategorized"],"readme":"# NTM-Lasagne\n\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/snipsco/ntm-lasagne/master/LICENSE)\n\nNTM-Lasagne is a library to create Neural Turing Machines (NTMs) in [Theano](http://deeplearning.net/software/theano/) using the [Lasagne](http://lasagne.readthedocs.org/) library. If you want to learn more about NTMs, check out our [blog post](https://medium.com/snips-ai/ntm-lasagne-a-library-for-neural-turing-machines-in-lasagne-2cdce6837315#.63t84s5r5).\n\nThis library features:\n - A Neural Turing Machine layer `NTMLayer`, where all its components (controller, heads, memory) are fully customizable.\n - Two types of controllers: a feed-forward `DenseController` and a \"vanilla\" recurrent `RecurrentController`.\n - A dashboard to visualize the inner mechanism of the NTM.\n - Generators to sample examples from algorithmic tasks.\n\n## Getting started\nTo avoid any conflict with your existing Python setup, and to keep this project self-contained, it is suggested to work in a virtual environment with [`virtualenv`](http://docs.python-guide.org/en/latest/dev/virtualenvs/). To install `virtualenv`:\n```bash\nsudo pip install --upgrade virtualenv\n```\n\nCreate a virtual environment called `venv`, activate it and install the requirements given by `requirements.txt`. NTM-Lasagne requires the bleeding-edge version, check the [Lasagne installation instructions](http://lasagne.readthedocs.org/en/latest/user/installation.html#bleeding-edge-version) for details. The latest version of [Lasagne](https://github.com/Lasagne/Lasagne/) is included in the `requirements.txt`.\n```bash\nvirtualenv venv\nsource venv/bin/activate\npip install -r requirements.txt\npip install .\n```\n\n## Example\nHere is minimal example to define a `NTMLayer`\n\n```python\n# Neural Turing Machine Layer\nmemory = Memory((128, 20), memory_init=lasagne.init.Constant(1e-6),\n    learn_init=False, name='memory')\ncontroller = DenseController(l_input, memory_shape=(128, 20),\n    num_units=100, num_reads=1,\n    nonlinearity=lasagne.nonlinearities.rectify,\n    name='controller')\nheads = [\n    WriteHead(controller, num_shifts=3, memory_shape=(128, 20),\n        nonlinearity_key=lasagne.nonlinearities.rectify,\n        nonlinearity_add=lasagne.nonlinearities.rectify,\n        learn_init=False, name='write'),\n    ReadHead(controller, num_shifts=3, memory_shape=(128, 20),\n        nonlinearity_key=lasagne.nonlinearities.rectify,\n        learn_init=False, name='read')\n]\nl_ntm = NTMLayer(l_input, memory=memory, controller=controller, heads=heads)\n```\n\nFor more detailed examples, check the [`examples` folder](examples/). If you would like to train a Neural Turing Machine on one of these examples, simply run the corresponding script, like\n\n```\nPYTHONPATH=. python examples/copy-task.py\n```\n\n## Tests\nThis projects has a few basic tests. To run these tests, you can run the `py.test` on the project folder\n```bash\nvenv/bin/py.test ntm -vv\n```\n\n## Known issues\nGraph optimization is computationally intensive. If you are encountering suspiciously long compilation times (more than a few minutes), you may need to increase the amount of memory allocated (if you run it on a Virtual Machine). Alternatively, turning off the swap may help for debugging (with `swapoff`/`swapon`).\n\nNote: Unlucky initialisation of the parameters might lead to a diverging solution (`NaN` scores).\n\n## Paper\nAlex Graves, Greg Wayne, Ivo Danihelka, *Neural Turing Machines*, [[arXiv](https://arxiv.org/abs/1410.5401)]\n\n## Contributing\n\nPlease see the [Contribution Guidelines](https://github.com/snipsco/ntm-lasagne/blob/master/CONTRIBUTING.md).\n\n## Copyright\n\nThis library is provided by [Snips](https://www.snips.ai) as Open Source software. See [LICENSE](https://github.com/snipsco/ntm-lasagne/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnipsco%2Fntm-lasagne","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnipsco%2Fntm-lasagne","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnipsco%2Fntm-lasagne/lists"}