DrQA

This agent is a (partial) implementation of the DrQA Document Reader from:

Danqi Chen, Adam Fisch, Jason Weston, Antoine Bordes. 2017. Reading Wikipedia to Answer Open-Domain Questions. In Association for Computational Linguistics (ACL).

Read more about DrQA here.

Basic Examples

Train a DrQA model on SQuAD.

python projects/drqa/train.py

Evaluate a pre-trained model on SQuAD.

python projects/drqa/eval_pretrained.py

DictionaryAgent Options

BPEHelper Arguments

Argument

Description

--bpe-vocab

Path to pre-trained tokenizer vocab

--bpe-merge

Path to pre-trained tokenizer merge

DrqaAgent Options

DrQA Arguments

Argument

Description

--no-cuda

Default: False.

--gpu

Default: -1.

--random-seed

Default: 1013.

--embedding-file

File of space separated embeddings: w e1 … ed

--init-model

Load dict/features/weights/opts from this file

--log-file

--fix-embeddings

Default: True.

--tune-partial

Train the K most frequent word embeddings

Default: 0.

--embedding-dim

Default embedding size if embedding_file is not given

Default: 300.

--hidden-size

Hidden size of RNN units

Default: 128.

--doc-layers

Number of RNN layers for passage

Default: 3.

--question-layers

Number of RNN layers for question

Default: 3.

--rnn-type

RNN type: lstm (default), gru, or rnn

Default: lstm.

--valid-metric

Metric for choosing best valid model

Choices: accuracy, f1.

Default: f1.

--max-len

The max span allowed during decoding

Default: 15.

--rnn-padding

Default: False.

--display-iter

Print train error after every<display_iter> epoches (default 10)

Default: 10.

--dropout-emb

Dropout rate for word embeddings

Default: 0.4.

--dropout-rnn

Dropout rate for RNN states

Default: 0.4.

--dropout-rnn-output

Whether to dropout the RNN output

Default: True.

--optimizer

Optimizer: sgd or adamax (default)

Default: adamax.

--learning-rate, -lr

Learning rate for SGD (default 0.1)

Default: 0.1.

--grad-clipping

Gradient clipping (default 10.0)

Default: 10.

--weight-decay

Weight decay (default 0)

Default: 0.

--momentum

Momentum (default 0)

Default: 0.

--subsample-docs

When given paragraphs (separated by

) will take only a subset of them, including the one with the answer for training.

Default: 0.

--concat-rnn-layers

Default: True.

--question-merge

The way of computing question representation

Default: self_attn.

--use-qemb

Whether to use weighted question embeddings

Default: True.

--use-in-question

Whether to use in_question features

Default: True.

--use-tf

Whether to use tf features

Default: True.

--use-time

Time features marking how recent word was said

Default: 0.

BPEHelper Arguments

Argument

Description

--bpe-vocab

Path to pre-trained tokenizer vocab

--bpe-merge

Path to pre-trained tokenizer merge

--pretrained-words

Use only words found in provided embedding_file

Default: True.

SimpleDictionaryAgent Options

BPEHelper Arguments

Argument

Description

--bpe-vocab

Path to pre-trained tokenizer vocab

--bpe-merge

Path to pre-trained tokenizer merge

--pretrained-words

Use only words found in provided embedding_file

Default: True.