All Projects → matthew-z → R Net

matthew-z / R Net

Licence: mit
R-net in PyTorch, with ELMo

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to R Net

co-attention
Pytorch implementation of "Dynamic Coattention Networks For Question Answering"
Stars: ✭ 54 (-72.16%)
Mutual labels:  squad
Reading comprehension tf
Machine Reading Comprehension in Tensorflow
Stars: ✭ 37 (-80.93%)
Mutual labels:  squad
Mnemonicreader
A PyTorch implementation of Mnemonic Reader for the Machine Comprehension task
Stars: ✭ 137 (-29.38%)
Mutual labels:  squad
R Net
A Tensorflow Implementation of R-net: Machine reading comprehension with self matching networks
Stars: ✭ 321 (+65.46%)
Mutual labels:  squad
Awesome Qa
😎 A curated list of the Question Answering (QA)
Stars: ✭ 596 (+207.22%)
Mutual labels:  squad
Bidaf Pytorch
An Implementation of Bidirectional Attention Flow
Stars: ✭ 42 (-78.35%)
Mutual labels:  squad
FastFusionNet
A PyTorch Implementation of FastFusionNet on SQuAD 1.1
Stars: ✭ 38 (-80.41%)
Mutual labels:  squad
R Net In Keras
Open R-NET implementation and detailed analysis: https://git.io/vd8dx
Stars: ✭ 181 (-6.7%)
Mutual labels:  squad
Fusionnet
My implementation of the FusionNet for machine comprehension
Stars: ✭ 29 (-85.05%)
Mutual labels:  squad
Haystack
🔍 Haystack is an open source NLP framework that leverages Transformer models. It enables developers to implement production-ready neural search, question answering, semantic document search and summarization for a wide range of applications.
Stars: ✭ 3,409 (+1657.22%)
Mutual labels:  squad
Drqa
A pytorch implementation of Reading Wikipedia to Answer Open-Domain Questions.
Stars: ✭ 378 (+94.85%)
Mutual labels:  squad
R Net
Tensorflow Implementation of R-Net
Stars: ✭ 582 (+200%)
Mutual labels:  squad
Match Lstm
A PyTorch implemention of Match-LSTM, R-NET and M-Reader for Machine Reading Comprehension
Stars: ✭ 92 (-52.58%)
Mutual labels:  squad
Learning to retrieve reasoning paths
The official implementation of ICLR 2020, "Learning to Retrieve Reasoning Paths over Wikipedia Graph for Question Answering".
Stars: ✭ 318 (+63.92%)
Mutual labels:  squad
Allure
Allure of the Stars is a near-future Sci-Fi roguelike and tactical squad combat game written in Haskell; please offer feedback, e.g., after trying out the web frontend version at
Stars: ✭ 149 (-23.2%)
Mutual labels:  squad
qa
TensorFlow Models for the Stanford Question Answering Dataset
Stars: ✭ 72 (-62.89%)
Mutual labels:  squad
Qanet
A Tensorflow implementation of QANet for machine reading comprehension
Stars: ✭ 996 (+413.4%)
Mutual labels:  squad
X3daudio1 7 hrtf
HRTF for Arma 3, Skyrim, and other titles that use XAudio2 + X3DAudio
Stars: ✭ 192 (-1.03%)
Mutual labels:  squad
Albert Tf2.0
ALBERT model Pretraining and Fine Tuning using TF2.0
Stars: ✭ 180 (-7.22%)
Mutual labels:  squad
Bi Att Flow
Bi-directional Attention Flow (BiDAF) network is a multi-stage hierarchical process that represents context at different levels of granularity and uses a bi-directional attention flow mechanism to achieve a query-aware context representation without early summarization.
Stars: ✭ 1,472 (+658.76%)
Mutual labels:  squad

An unofficial implementation of R-net in PyTorch and AllenNLP.

Natural Language Computing Group, MSRA: R-NET: Machine Reading Comprehension with Self-matching Networks

Actually, I didn't reproduce the model of this paper exactly because some details are not very clear to me and the dynamic attention in self-matching requires too much memory. Instead, I implemented the variant of R-Net according to HKUST-KnowComp/R-Net (in Tensorflow).

The biggest difference between the original R-net and HKUST R-net is that:

  • The original R-net performs attention at each RNN step, which means that the hidden states are involved in the attention calculation. I call it dynamic attention.
  • In HKUST R-Net, attentions (in pair encoder and self-matching encoder) are calculated before performing RNN. I call it static attention.

Some details in HKUST-KnowComp/R-Net that improves performance:

  • Question and Passage share the same GRU sentence encoder instead of using two GRU encoders respectively.
  • The sentence encoder has three layers, but its output is the concat of the three layers instead of the output of the top layer.
  • The GRUs in the pair encoder and the self-matching encoder have only one layer instead of three layers.
  • Variational dropouts are applied to (1) the inputs of RNNs (2) inputs of attentions

Furthermore, this repo added ELMo word embeddings, which further improved the model's performance.

Dependency

  • Python == 3.6
  • AllenNLP == 0.7.2
  • PyTorch == 1.0

Usage

git clone https://github.com/matthew-z/R-net.git
cd R-net
python main.py train configs/squad/r-net/hkust.jsonnet  // HKUST R-Net

Note that the batch size may be a bit too large for 11GB GPUs. Please try 64 in case of OOM Error by adding the following arg: -o '{"iterator.batch_size": 64}'

Configuration

The models and hyperparameters are declared in configs/

  • the HKUST R-Net: configs/r-net/hkust.jsonnet (79.4 F1)
    • +ELMo: configs/r-net/hkust+elmo.jsonnet (82.2 F1)
  • the original R-Net: configs/r-net/original.jsonnet (currently not workable)

Performance

This implementation of HKUST R-Net can obtain 79.4 F1 and 70.5 EM on the validation set.

  • ELMo: 82.2 F1 and 74.4 EM.

The visualization of R-Net + Elmo Training: Red: training score, Green: validation score

Note that validation score is higher than training because each validation has three acceptable answers, which makes validation easier than training.

Future Work

  • Add BERT: A preliminary implementation is in configs/r-net/hkust+bert.jsonnet
  • Add ensemble training
  • Add FP16 training

Acknowledgement

Thank HKUST-KnowComp/R-Net for sharing their Tensorflow implementation of R-net. This repo is based on their work.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].