{"id":13935794,"url":"https://github.com/HKUST-KnowComp/R-Net","last_synced_at":"2025-07-19T21:30:38.843Z","repository":{"id":101129301,"uuid":"112273500","full_name":"HKUST-KnowComp/R-Net","owner":"HKUST-KnowComp","description":"Tensorflow Implementation of R-Net","archived":false,"fork":false,"pushed_at":"2018-08-08T18:04:09.000Z","size":193,"stargazers_count":578,"open_issues_count":6,"forks_count":210,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-11-27T03:34:39.873Z","etag":null,"topics":["machine-comprehension","nlp","r-net","squad","tensorflow"],"latest_commit_sha":null,"homepage":"","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/HKUST-KnowComp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-11-28T02:12:47.000Z","updated_at":"2024-09-24T11:10:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"12a6df99-33d9-4fa8-88b6-87c4a553687e","html_url":"https://github.com/HKUST-KnowComp/R-Net","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HKUST-KnowComp/R-Net","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HKUST-KnowComp%2FR-Net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HKUST-KnowComp%2FR-Net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HKUST-KnowComp%2FR-Net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HKUST-KnowComp%2FR-Net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HKUST-KnowComp","download_url":"https://codeload.github.com/HKUST-KnowComp/R-Net/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HKUST-KnowComp%2FR-Net/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266019657,"owners_count":23864916,"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":["machine-comprehension","nlp","r-net","squad","tensorflow"],"created_at":"2024-08-07T23:02:05.914Z","updated_at":"2025-07-19T21:30:38.837Z","avatar_url":"https://github.com/HKUST-KnowComp.png","language":"Python","funding_links":[],"categories":["Python","Codes"],"sub_categories":["Most QA systems have roughly 3 parts"],"readme":"# R-Net\n  * A Tensorflow implementation of [R-NET: MACHINE READING COMPREHENSION WITH SELF-MATCHING NETWORKS](https://www.microsoft.com/en-us/research/wp-content/uploads/2017/05/r-net.pdf). This project is specially designed for the [SQuAD](https://arxiv.org/pdf/1606.05250.pdf) dataset.\n  * Should you have any question, please contact Wenxuan Zhou (wzhouad@connect.ust.hk).\n\n## Requirements\n\nThere have been a lot of known problems caused by using different software versions. Please check your versions before opening issues or emailing me.\n\n#### General\n  * Python \u003e= 3.4\n  * unzip, wget\n#### Python Packages\n  * tensorflow-gpu \u003e= 1.5.0\n  * spaCy \u003e= 2.0.0\n  * tqdm\n  * ujson\n\n## Usage\n\nTo download and preprocess the data, run\n\n```bash\n# download SQuAD and Glove\nsh download.sh\n# preprocess the data\npython config.py --mode prepro\n```\n\nHyper parameters are stored in config.py. To debug/train/test the model, run\n\n```bash\npython config.py --mode debug/train/test\n```\n\nTo get the official score, run\n\n```bash\npython evaluate-v1.1.py ~/data/squad/dev-v1.1.json log/answer/answer.json\n```\n\nThe default directory for tensorboard log file is `log/event`\n\nSee release for trained model.\n\n## Detailed Implementaion\n\n  * The original paper uses additive attention, which consumes lots of memory. This project adopts scaled multiplicative attention presented in [Attention Is All You Need](https://arxiv.org/abs/1706.03762).\n  * This project adopts variational dropout presented in [A Theoretically Grounded Application of Dropout in Recurrent Neural Networks](https://arxiv.org/abs/1512.05287).\n  * To solve the degradation problem in stacked RNN, outputs of each layer are concatenated to produce the final output.\n  * When the loss on dev set increases in a certain period, the learning rate is halved.\n  * During prediction, the project adopts search method presented in [Machine Comprehension Using Match-LSTM and Answer Pointer](https://arxiv.org/abs/1608.07905).\n  * To address efficiency issue, this implementation uses bucketing method (contributed by xiongyifan) and CudnnGRU. The bucketing method can speedup training, but will lower the F1 score by 0.3%.\n\n## Performance\n\n#### Score\n\n||EM|F1|\n|---|---|---|\n|original paper|71.1|79.5|\n|this project|71.07|79.51|\n\n\u003cimg src=\"img/em.jpg\" width=\"300\"\u003e\n\n\u003cimg src=\"img/f1.jpg\" width=\"300\"\u003e\n\n#### Training Time (s/it)\n\n||Native|Native + Bucket|Cudnn|Cudnn + Bucket|\n|---|---|---|---|---|\n|E5-2640|6.21|3.56|-|-|\n|TITAN X|2.56|1.31|0.41|0.28|\n\n## Extensions\n\nThese settings may increase the score but not used in the model by default. You can turn these settings on in `config.py`. \n\n * [Pretrained GloVe character embedding](https://github.com/minimaxir/char-embeddings). Contributed by yanghanxy.\n * [Fasttext Embedding](https://fasttext.cc/docs/en/english-vectors.html). Contributed by xiongyifan. May increase the F1 by 1% (reported by xiongyifan).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHKUST-KnowComp%2FR-Net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHKUST-KnowComp%2FR-Net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHKUST-KnowComp%2FR-Net/lists"}