{"id":15643289,"url":"https://github.com/gokumohandas/attentional-interfaces","last_synced_at":"2026-04-02T01:56:38.703Z","repository":{"id":89073057,"uuid":"82497867","full_name":"GokuMohandas/attentional-interfaces","owner":"GokuMohandas","description":"🔍 Attentional interfaces in TensorFlow.","archived":false,"fork":false,"pushed_at":"2018-12-26T04:15:21.000Z","size":88627,"stargazers_count":61,"open_issues_count":0,"forks_count":22,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-30T15:51:12.593Z","etag":null,"topics":["attention-mechanism","machine-learning","tensorflow"],"latest_commit_sha":null,"homepage":"https://www.oreilly.com/ideas/interpretability-via-attentional-and-memory-based-interfaces-using-tensorflow","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GokuMohandas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-19T23:41:33.000Z","updated_at":"2024-11-13T16:30:15.000Z","dependencies_parsed_at":"2023-06-13T19:30:32.819Z","dependency_job_id":null,"html_url":"https://github.com/GokuMohandas/attentional-interfaces","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GokuMohandas%2Fattentional-interfaces","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GokuMohandas%2Fattentional-interfaces/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GokuMohandas%2Fattentional-interfaces/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GokuMohandas%2Fattentional-interfaces/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GokuMohandas","download_url":"https://codeload.github.com/GokuMohandas/attentional-interfaces/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251693321,"owners_count":21628651,"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":["attention-mechanism","machine-learning","tensorflow"],"created_at":"2024-10-03T11:59:51.180Z","updated_at":"2026-04-02T01:56:38.656Z","avatar_url":"https://github.com/GokuMohandas.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## [Interpretability via Attentional and Memory-based Interfaces Using TensorFlow](https://www.oreilly.com/ideas/interpretability-via-attentional-and-memory-based-interfaces-using-tensorflow)\nA closer look at the reasoning inside your deep networks.\n\n**TLDR:** This post will serve as a gentle introduction to attentional and memory-based interfaces in deep neural architectures using TensorFlow. Incorporation of attention mechanisms is very simple and can improve transparency interpretability in our complex models. We will conclude with extensions and caveats of the interfaces. The intended audience for this notebook are developers and researchers who have some basic understanding of Tensorflow and fundamental deep learning concepts. Check out this [post](https://www.oreilly.com/learning/hello-tensorflow) for a nice introduction to Tensorflow. \n![image1](images/github_cover.jpg)\n**Note:** This code has been written for TensorFlow v1.0.0\n\nBefore running the Jupyter notebook [attention.ipynb](attention.ipynb), you'll need to ensure that your machine is set up to run TensorFlow and install a handful of helpful additional libraries.\n\n### Setup\n1. Download [this entire repo from GitHub](https://github.com/ajarai/O-Reilly)\n\n2. Open your terminal and use `cd` to navigate into the top directory of the repo on your machine\n\n3. Unzip the processed reviews data by entering the following inside the data directory.\n```bash\nunzip processed_reviews.zip\n```\n\nNow, set up your environment by using the Dockerfile included with this repo (option A) or configuring it manually (option B).\n\n#### Option A: use the Dockerfile configured for this notebook\n(Note: For GPU versions, etc. check out [TensorFlow's Docker repo](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/docker).)\n\n4. After downloading this repo to your machine, open your terminal and use `cd` to navigate to the directory that contains `Dockerfile.cpu`.\n\n5. To build the Dockerfile, enter\n```bash\ndocker build -t dockerfile_cpu -f dockerfile.cpu .\n```\nIf you get a permissions error on running this command, you may need to run it with `sudo`:\n```bash\nsudo  build -t dockerfile_cpu -f dockerfile.cpu .\n```\n\n6. Run Docker from the Dockerfile you've just built\n```bash\ndocker run -it -p 8888:8888 -p 6006:6006 dockerfile_cpu bash\n```\nor\n```bash\nsudo docker run -it -p 8888:8888 -p 6006:6006 dockerfile_cpu bash\n```\nif you run into permission problems.\n\n7. Launch Jupyter by entering\n```bash\njupyter notebook\n```\nand, using your browser, navigate to the URL shown in the terminal output (usually http://localhost:8888/)\n\n#### Option B: set up environment manually on local machine\nFor instructions on installing TensorFlow, please see [TensorFlow's platform-specific installation instructions](https://www.tensorflow.org/install/).\n```bash\nRequired:\npython 3.3+\npip 9.0.1 (sudo easy_install pip)\nvirtualenv (pip install virtualenv)\nOptional: CUDA enabled GPU (explicity define cpu components (embedding, etc.)\n```\n\n4. Enter the `attention` directory in your terminal and enter the following commands\n```bash\nmake venv\nsource oreilly-attention-venv/bin/activate\nmake load-data\nipython3 notebook attention.ipynb\n```\n5. Launch Jupyter by entering\n```bash\njupyter notebook\n```\nand, using your browser, navigate to the URL shown in the terminal output (usually http://localhost:8888/)\n\n\n### Contact:\nGoku Mohandas\n* Twitter: [@GokuMohandas](https://twitter.com/gokumohandas)\n* Github: [GokuMohandas](https://github.com/GokuMohandas)\n* Blog: [The Neural Perspective](http://www.theneuralperspective.com)\n* Linkedin: [Goku Mohandas](https://www.linkedin.com/in/goku)\n\n### Author Bio:\nGoku Mohandas is an artificial intelligence (AI) researcher in Silicon Valley with a focus on using deep learning for natural language tasks. His interests include research on AI for intelligent search and question answering augmented by attentional and memory-based interfaces. He also strongly believes in the democratization of AI with a focus on interpretability and transparency. Previous work includes working on the intersection of AI and biotechnology at the Johns Hopkins University Applied Physics Laboratory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgokumohandas%2Fattentional-interfaces","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgokumohandas%2Fattentional-interfaces","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgokumohandas%2Fattentional-interfaces/lists"}