{"id":18892989,"url":"https://github.com/dongjunlee/dmn-tensorflow","last_synced_at":"2025-04-15T00:13:57.406Z","repository":{"id":236588781,"uuid":"112942407","full_name":"DongjunLee/dmn-tensorflow","owner":"DongjunLee","description":"TensorFlow implementation of 'Ask Me Anything: Dynamic Memory Networks for Natural Language Processing (2015)'","archived":false,"fork":false,"pushed_at":"2018-05-21T02:40:59.000Z","size":327,"stargazers_count":42,"open_issues_count":0,"forks_count":25,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-15T00:13:42.245Z","etag":null,"topics":["babi-tasks","dynamic-memory-network","hb-experiment","natural-language-processing","nlp","question-answering","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","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/DongjunLee.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-12-03T16:07:07.000Z","updated_at":"2024-01-29T03:56:53.000Z","dependencies_parsed_at":"2024-05-08T19:15:49.676Z","dependency_job_id":null,"html_url":"https://github.com/DongjunLee/dmn-tensorflow","commit_stats":null,"previous_names":["dongjunlee/dmn-tensorflow"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DongjunLee%2Fdmn-tensorflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DongjunLee%2Fdmn-tensorflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DongjunLee%2Fdmn-tensorflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DongjunLee%2Fdmn-tensorflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DongjunLee","download_url":"https://codeload.github.com/DongjunLee/dmn-tensorflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248981271,"owners_count":21193147,"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":["babi-tasks","dynamic-memory-network","hb-experiment","natural-language-processing","nlp","question-answering","tensorflow"],"created_at":"2024-11-08T08:06:57.163Z","updated_at":"2025-04-15T00:13:57.386Z","avatar_url":"https://github.com/DongjunLee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dynamic Memory Network [![hb-research](https://img.shields.io/badge/hb--research-experiment-green.svg?style=flat\u0026colorA=448C57\u0026colorB=555555)](https://github.com/hb-research)\n\nTensorFlow implementation of [Ask Me Anything:\nDynamic Memory Networks for Natural Language Processing](https://arxiv.org/pdf/1506.07285.pdf).\n\n![images](images/ask_me_anything_figure_3.png)\n\n\n## Requirements\n\n- Python 3.6\n- TensorFlow 1.8\n- [hb-config](https://github.com/hb-research/hb-config) (Singleton Config)\n- nltk (tokenizer and blue score)\n- tqdm (progress bar)\n\n\n## Project Structure\n\ninit Project by [hb-base](https://github.com/hb-research/hb-base)\n\n    .\n    ├── config                  # Config files (.yml, .json) using with hb-config\n    ├── data                    # dataset path\n    ├── notebooks               # Prototyping with numpy or tf.interactivesession\n    ├── dynamic_memory          # dmn architecture graphs (from input to output)\n        ├── __init__.py             # Graph logic\n        ├── encoder.py              # Encoder\n        └── episode.py              # Episode and AttentionGate\n    ├── data_loader.py          # raw_date -\u003e precossed_data -\u003e generate_batch (using Dataset)\n    ├── hook.py                 # training or test hook feature (eg. print_variables)\n    ├── main.py                 # define experiment_fn\n    └── model.py                # define EstimatorSpec      \n\nReference : [hb-config](https://github.com/hb-research/hb-config), [Dataset](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_generator), [experiments_fn](https://www.tensorflow.org/api_docs/python/tf/contrib/learn/Experiment), [EstimatorSpec](https://www.tensorflow.org/api_docs/python/tf/estimator/EstimatorSpec)\n\n\n## Todo\n\n- Implements DMN+ ([Dynamic Memory Networks for Visual and Textual Question Answering](https://arxiv.org/pdf/1603.01417.pdf) (2016) by C Xiong)\n\n\n\n## Config\n\nexample: bAbi_task1.yml\n\n```yml\ndata:\n  base_path: 'data/'\n  task_path: 'en-10k/'\n  task_id: 1\n  PAD_ID: 0\n\nmodel:\n  batch_size: 16\n  use_pretrained: true             # (true or false)\n  embed_dim: 50                    # if use_pretrained: only available 50, 100, 200, 300\n  encoder_type: uni                # uni, bi\n  cell_type: gru                   # lstm, gru, layer_norm_lstm, nas\n  num_layers: 1\n  num_units: 32\n  memory_hob: 3\n  dropout: 0.0\n  reg_scale: 0.001\n\ntrain:\n  learning_rate: 0.0001\n  optimizer: 'Adam'                # Adagrad, Adam, Ftrl, Momentum, RMSProp, SGD\n\n  train_steps: 100000\n  model_dir: 'logs/bAbi_task1'\n\n  save_checkpoints_steps: 1000\n  check_hook_n_iter: 1000\n  min_eval_frequency: 1000\n\n  print_verbose: False\n  debug: False\n```\n\n\n## Usage\n\nInstall requirements.\n\n```pip install -r requirements.txt```\n\nThen, prepare dataset and pre-trained glove.\n\n```\nsh scripts/fetch_babi_data.sh\nsh scripts/fetch_glove_data.sh\n```\n\nFinally, start trand and evalueate model\n```\npython main.py --config bAbi_task1 --mode train_and_evaluate\n```\n\n### Experiments modes\n\n:white_check_mark: : Working  \n:white_medium_small_square: : Not tested yet.\n\n\n- :white_check_mark: `evaluate` : Evaluate on the evaluation data.\n- :white_medium_small_square: `extend_train_hooks` :  Extends the hooks for training.\n- :white_medium_small_square: `reset_export_strategies` : Resets the export strategies with the new_export_strategies.\n- :white_medium_small_square: `run_std_server` : Starts a TensorFlow server and joins the serving thread.\n- :white_medium_small_square: `test` : Tests training, evaluating and exporting the estimator for a single step.\n- :white_check_mark: `train` : Fit the estimator using the training data.\n- :white_check_mark: `train_and_evaluate` : Interleaves training and evaluation.\n\n---\n\n\n### Tensorboar\n\n```tensorboard --logdir logs```\n\n\n## Reference\n\n- [Implementing Dynamic memory networks](https://yerevann.github.io/2016/02/05/implementing-dynamic-memory-networks/)\n- [arXiv - Ask Me Anything:\nDynamic Memory Networks for Natural Language Processing](https://arxiv.org/abs/1506.07285) (2015. 6) by A Kumar\n- [arXiv - Dynamic Memory Networks for Visual and Textual Question Answering](https://arxiv.org/abs/1603.01417) (2016. 3) by C Xiong\n\n## Author\n\nDongjun Lee (humanbrain.djlee@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdongjunlee%2Fdmn-tensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdongjunlee%2Fdmn-tensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdongjunlee%2Fdmn-tensorflow/lists"}